Closed MDAR closed 1 year ago
You can use these color codes https://github.com/M5stack/M5StickC/blob/8468b22249195d17a6d2fff9f830269200abc21b/src/utility/ST7735_Defines.h#L100-L118 If you use the command alone (as follows),
color = 0x000001 to 0x0000ff
tftSprite.setTextColor(color)
If StickC can work normally, but after the remote transmission of the color appeared abnormal, that is to say that the data read from the MQTT into the corresponding color conversion process has a problem, you can focus on reading the data, each color data separate output, to see where the problem is in the end
@Tinyu-Zhao
Re
You can use these color codes https://github.com/M5stack/M5StickC/blob/8468b22249195d17a6d2fff9f830269200abc21b/src/utility/ST7735_Defines.h#L100-L118 If you use the command alone (as follows),
color = 0x000001 to 0x0000ff tftSprite.setTextColor(color)
I think I see the issue
I've been sending six digital colours, not four
The link you have provided shows four digit colours.
Would you happen to have a reference for your to create 4 digital HEX colours?
Thanks for your assistance, yet again.
Those color codes are RGB565 https://rgbcolorpicker.com/565
Those color codes are RGB565 https://rgbcolorpicker.com/565
Thank you so much for your assistance.
I've read this and think I might be able to do the RGB24 to RGB565 in NodeRed before sending over MQTT, hopefully without any changes to my M5StickC code.
http://www.barth-dev.de/about-rgb565-and-how-to-convert-into-it/
Based loosely on this formula
RGB565 = (((RGB888_RedValue & 0xf80000)>>8) + ((RGB888_GreenValue & 0xfc00)>>5) + ((RGB888_BlueValue & 0xf8)>>3));
I'll try it later on the week and report the results.
Maybe you can use this function uint16_t color565(uint8_t red, uint8_t green, uint8_t blue); This article describes the instructions https://programmer.ink/think/color-setting-and-text-display-esp32-learning-tour-arduino-version.html
Thanks for all your help and support.
I've gone the very long way around to get an RGB565 value from a colour picker and double checked the results with various web converters I've found.
I'm fairly confident that I'm creating the correct RGB565 values and passing them to the M5stickC-Plus.
Some work very well, others are wildly wrong.
For this exercise, I think I'll stick to using hard coded / fixed values in the TFT library or send RGB565 values from an option list, rather than a colour picker.
I've learnt a lot in the exercise, so nothing has been wasted.
For your reference and for anyone else that is looking for RGB565 convertion
https://github.com/soloam/node-red-contrib-colorspace/issues/8
https://discourse.nodered.org/t/rgb565-color-space-mainly-for-spi-tft-screens/80574
I have tried looking for more information and I can't find it, I apologise if the info or a detailed example is somewhere.
Regarding these commands for a M5StickC and M5StickC-Plus
or
Where
bgColour
andColour
are eitherint
orunit32_t
What I'm trying to achieve is the ability to set the Screen colour and Text colour via a MQTT message.
{"bgColour":0xFF0000,"Colour":0x00FF00}
for exampleSo far I can pass HEX values to a Key in the M5StickC, but when applied to the commands, the colours are very strange.
0x000001
to0x0000ff
work perfectly for all four commands, ever tone of Blue that I could ever want,But when I try to add RED or GREEN, the colours are very strange.
Is it that I can ONLY use the preset colour options?
Where can I find the list?
Are these correct?
https://github.com/Bodmer/TFT_eSPI/blob/master/TFT_eSPI.h
As a work around, I have limited myself to 8 colour options and set the colour based on the MQTT message
and so on
The core question is
What is the correct way to pass a HEX colour value to either the
tftSprite.fillRect(
orM5.Lcd.fillScreen(
commands?For reference, if I do the this with the MiniEncoder LED, it works PERFECTLY
using JSON messages like these
or anything. (I use a colour picker in Node-RED for testing)
(Going forward, I want to try to add the 8-Encoder to this script)
Many thanks in advance.
Going forward, is it acceptable to post an example script when I have this working?