Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login
    1. Home
    2. Nil Orbach
    3. Posts
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 12
    • Best 2
    • Controversial 0
    • Groups 0

    Posts made by Nil Orbach

    • RE: Custom image on PanelDue main pages

      @mfs12 According to what dc42 said, my image has the right format. dc42 said:
      "The format is very simple:

      • word (16 bits) repeat count minus one (so 0 means that the following pixel is displayed just once, 1 means it is displayed twice etc.)

      • word (16 bits) pixel colours in 565 format (e.g. 5 bits red, 6 bits green, 5 bits blue)

      • Repeated as necessary"

      This is exactly what I got after using the bmp2c -binary command, and after opening this binary file with a binary editor and copying the uint16_t hex code into my code so that the StaticImageField() method can display it by calling drawCompressedBitmap().

      Here is the splash screen format:
      15f5d172-dbe6-4320-a777-d681131a6647-image.png

      And here is my image format in the code:
      6aebcf94-a47a-4e22-a0a7-856d2b7b4e43-image.png
      They are the same!

      Concerning the splash screen, it is called with drawCompressedBitmapBottomToTop(0, 0, DISPLAY_X, DISPLAY_Y, _esplash + 2).

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @mfs12 these functions are not exactly the same. The button function calls drawBitmap4() which then calls LCD_Write_Repeated_DATA16() whereas image function calls drawCompressedBitmap() which then calls LCD_Write_DATA16(). These functions may look similar, but I do not think I will explore that further. I will let my image as a button, it is not that bad!

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @mfs12 Hi, actually it was not really solved, but as nobody seems to know the answer, I guess you can close it 🙂

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • Custom palette in bmp2c.go file

      Hi everyone,

      I would like to custom the bmp2c tool in order to make my own palette (like adding some blue for my icons, etc.), so I am looking for information about the color conversion that is performed. In the bmp2c.go file, the function getPaletteIndex() calls the to16BitColor() and performs a switch depending on its result (see below).

      func getPaletteIndex(r, g, b, a uint32) int {
      
      	// 0x0000, 0xffff, 0x20e4, 0xffdf, 0x18e3, 0xf79e, 0xc986, 0xd30c,
      	// 0xc103, 0xff52, 0xfffb, 0x4569, 0x9492, 0x0000, 0x0000, 0x0000
      
      	switch to16BitColor(r, g, b, a) {
      	case 0xffff: // e.g. 0xffffff
      		return 1
      	case 0x20e4: // e.g. 0x201c20
      		return 2
      	case 0xffdf: // e.g. 0xf8f8f8
      		return 3
      	case 0x18e3: // e.g. 0x181c18
      		return 4
      	case 0xf79e: // e.g. 0xf0f0f0
      		return 5
      	case 0xc986: // e.g. 0xc83030
      		return 6
      	case 0xd30c: // e.g. 0xd06060
      		return 7
      	case 0xc103: // e.g. 0xc02018
      		return 8
      	case 0xff52: // e.g. 0xf8e890
      		return 9
      	case 0xfffb: // e.g. 0xf8fcd8
      		return 10
      	case 0x4569: // e.g. 0x40ac48
      		return 11
      	case 0x9492: // e.g. 0x909090
      		return 12
      	default:
      		return 0
      	}
      }
      
      func to16BitColor(r, g, b, a uint32) uint16 {
      	return uint16((r&0xF8)<<8) | uint16((g&0xFC)<<3) | uint16((b&0xF8)>>3)
      }
      

      As to16BitColor converts r, g, b into a single uint16_t, there sould be a multitude of possible outputs for this switch: 2^16 = 65,536 colors! So, why are there only 13 outputs? I mean, from a 24-bit image.bpm taken as input, how is it possible that all the colors (2^24 !) can match these 13 outputs?

      I have already looked into the image library of golang here which is used in the file (especially the At() and bmp.Decode() functions) but I did not find the answer I was looking for (also, I am not familiar with Go!).

      Is there anyone having worked on the bmp2c.go file who could help me? 🙂

      posted in Firmware developers paneldue bmp2c palette
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @mfs12 I keep looking for what may be wrong. I hope I succeed too so that it will help those who could face the same problem in the future 🙂

      The image dimensions are good. Here is the same image displayed as a button, with the AddIconButton() function and an uint8_t array of my image generated with the bmp2c tool thanks to your first message:
      ButtonCNCSuccess.jpg
      The button is large, but the image dimensions are the same than those displayed with the StaticImageField() function.

      Anyway, thanks for your help, that was very kind! 🙂

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @mfs12 I can successfully change the splash screen with the bmp2C tool. Here are some photos to illustrate my problem:
      First, the splash screen (this one is just a random image for the example) :SplashScreenCNC.jpg

      And now, the same image displayed with the StaticImageField() function, after following the procedure described in my previous message:ImageCNCFailure.jpg
      (The screen may look unfamiliar, as I have already customized and removed some buttons 🙂 )

      So, I think my array is good, but I may miss something when calling the StaticImageField()...

      Here is how I call this function: mgr.AddField(new StaticImageField(row3, DISPLAY_X - 270, 120, 131, ImageCNC)); //height = 120, width = 131

      And my ImageCNC array is: extern const uint16_t ImageCNC[] = { 131, 120, 0x0292, 0xffff, 0x0000, 0xef5d, 0x0000, 0xd69a, 0x0071, 0xd6ba, 0x0000, 0xe6fb, 0x000d, 0xffff, 0x0000, 0x7bef, 0x0072, 0x0000, 0x0000, 0x39e7, etc. }

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @dc42 Hello, thanks for your help. I really appreciate it!

      After reading your post, I generated a binary file from my 24-bit bmp image with the bmp2c tool. Then, I opened the binary file with a binary editor (Hex Neo Editor) and I displayed all the data as hex words (16 bits). Finally, I copied these words into my uint16_t array and called this array with the StaticImageField() function. As you said, I get the format you described: width, height, and then repeat byte followed by a pixel byte. But I still get something wrong: a white square with black lines (like a bar code - definitely not my image!).

      Did I make something wrong during the process?

      And by the way, thanks for the hard work you put into the Duet project! 🙂

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      @mfs12 Hello,

      Unfortunately, I did not manage to display my image with StaticImageField(). I have tried to convert my uin8_t icon into a uin16_t one by converting, for example, 0x13 into 0xffff, 0xffdf, then into 0x0000, 0x0003, with then without the height and width at the beginning of the array, but none of this has ever worked. Depending of what I test, I get a white square, or a black one with some blue, etc. - but not my image!

      Actually, the function called by StaticImageField() is drawCompressedBitmap(), which is almost the same function than drawCompressedBitmapBottomToTop() which is used to display the splash screen. Both take a uin16_t array of data as argument. If I could know how is coded the splash screen after the bmp2c tool is used, I could maybe try to code my image the same way. But, as I am not familiar with the go functions used in bmp2c.go, I do not really understand what computation is performed on the initial 24 bits bmp image.

      Or maybe the StaticImageField() or drawCompressedBitmap() functions have some error - it is hard to tell as they are never used in the code...

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      Thanks anyway for your kindly help, @mfs12 🙂

      Actually, I have just answered my second question about the color palette by reading the bmp2c.go file. I found in the function getPaletteIndex() the following corresponding table :

      switch to16BitColor(r, g, b, a) {
      case 0xffff: // e.g. 0xffffff
      	return 1
      case 0x20e4: // e.g. 0x201c20
      	return 2
      case 0xffdf: // e.g. 0xf8f8f8
      	return 3
      case 0x18e3: // e.g. 0x181c18
      	return 4
      case 0xf79e: // e.g. 0xf0f0f0
      	return 5
      case 0xc986: // e.g. 0xc83030
      	return 6
      case 0xd30c: // e.g. 0xd06060
      	return 7
      case 0xc103: // e.g. 0xc02018
      	return 8
      case 0xff52: // e.g. 0xf8e890
      	return 9
      case 0xfffb: // e.g. 0xf8fcd8
      	return 10
      case 0x4569: // e.g. 0x40ac48
      	return 11
      case 0x9492: // e.g. 0x909090
      	return 12
      default:
      	return 0
      }
      

      So, for anyone interested, when you read for example 0x01 in the IconHomeAll array in HomeIcon.cpp, it means that the first bit color is black (0 is default, i.e. black) and that the second bit color is white (1 is 0xFFFF, i.e. white), as there is 2 pixels/bit.

      I am looking for coding my image in 16 bits to use the StaticImageField() function and will let you know when (if!) I succeed.

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • RE: Custom image on PanelDue main pages

      Thanks for your answer, @mfs12. I knew the bmp2c tool (I had already replaced the splash screen before) but I did not know it could be used to generate custom icons. Thanks for the tip! I successfully managed to insert my newly created icon as a button on the main pages.

      Unfortunately, this generates an array of uin8_t, whereas an uin16_t is required for the StaticImageField() function. Also, as a uint8_t is generated, I do not understand why the color palette on Github is given as a "16-bit output". The hex value of each color does not correspond to what I obtained with the bmp2c tool, or to what I can see in the HomeIcons.cpp, for example!

      So, do you know how I could turn this uin8_t array into a uint16_t array, and also how to interpret the color palette on Github?

      posted in Firmware developers
      Nil Orbachundefined
      Nil Orbach
    • Custom image on PanelDue main pages

      Hi everyone,

      I have bought a PanelDue 7i and a Duet 3 to drive a CNC. On the "Control" and "Status" pages of the PanelDue, I would like to display a custom image. I have already removed some unused buttons to make some room. I am using the 3.3.0-rc4 firmware.

      At the end of the display.hpp file, in the last class, I see a function StaticImageField() which is not used in the code but that I would like to use to display my image. But this function takes (const uint16_t * _ecv_array imageData) as an argument to display the image. Therefore, I cannot "copy" the way the icons are coded to code my image as an array.

      As I am not familiar with image conversion, so does someone know a tool to convert an image into a uint16_t array? In which format should I save the image before processing to the conversion? etc.

      Best regards,

      Nil

      posted in Firmware developers custom firmware paneldue
      Nil Orbachundefined
      Nil Orbach