mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Rewrote TM1637 driver as a Display Driver
This commit is contained in:
parent
fad5ae755e
commit
d2d7a408c8
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 210 KiB |
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 210 KiB |
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -638,8 +638,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -783,6 +781,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -635,8 +635,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -780,6 +778,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "CarteSD CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 - CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 - DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 - STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 - SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 - DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 - DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 - CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 - DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 - CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 - DIO"
|
||||
#define D_SENSOR_SDCARD_CS "Scheda SD - CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand - D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand - D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -639,8 +639,6 @@
|
||||
#define D_SENSOR_TM1638_CLK "TM16 CLK"
|
||||
#define D_SENSOR_TM1638_DIO "TM16 DIO"
|
||||
#define D_SENSOR_TM1638_STB "TM16 STB"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_HX711_SCK "HX711 SCK"
|
||||
#define D_SENSOR_HX711_DAT "HX711 DAT"
|
||||
#define D_SENSOR_FTC532 "FTC532"
|
||||
@ -784,6 +782,8 @@
|
||||
#define D_SENSOR_ST7789_DC "ST7789 DC"
|
||||
#define D_SENSOR_SSD1331_CS "SSD1331 CS"
|
||||
#define D_SENSOR_SSD1331_DC "SSD1331 DC"
|
||||
#define D_SENSOR_TM1637_CLK "TM1637 CLK"
|
||||
#define D_SENSOR_TM1637_DIO "TM1637 DIO"
|
||||
#define D_SENSOR_SDCARD_CS "SDCard CS"
|
||||
#define D_SENSOR_WIEGAND_D0 "Wiegand D0"
|
||||
#define D_SENSOR_WIEGAND_D1 "Wiegand D1"
|
||||
|
@ -635,6 +635,7 @@
|
||||
// #define USE_DISPLAY_RA8876 // [DisplayModel 10] [I2cDriver39] (Touch)
|
||||
// #define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
// #define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module
|
||||
// #define USE_DISPLAY_TM1637 // [DisplayModel 15] Enable TM1637 module
|
||||
// #define USE_RC522 // Add support for MFRC522 13.56Mhz Rfid reader (+6k code)
|
||||
// #define USE_RC522_DATA_FUNCTION // Add support for reading data block content (+0k4 code)
|
||||
// #define USE_RC522_TYPE_INFORMATION // Add support for showing card type (+0k4 code)
|
||||
@ -776,7 +777,6 @@
|
||||
// -- Other sensors/drivers -----------------------
|
||||
|
||||
//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
|
||||
//#define USE_TM1637 // Add support for TM1637 seven-segment display (+1k code)
|
||||
//#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
||||
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
|
||||
|
||||
|
@ -320,9 +320,6 @@ void ResponseAppendFeatures(void)
|
||||
#endif
|
||||
#ifdef USE_TM1638
|
||||
feature3 |= 0x80000000; // xsns_28_tm1638.ino
|
||||
#endif
|
||||
#ifdef USE_TM1637
|
||||
feature3 |= 0x100000000; // xsns_85_tm1637.ino
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -715,6 +712,9 @@ void ResponseAppendFeatures(void)
|
||||
#if defined(USE_I2C) && defined(USE_TOF10120)
|
||||
feature7 |= 0x10000000; // xsns_84_tof10120
|
||||
#endif
|
||||
#if defined(USE_DISPLAY) && defined(USE_DISPLAY_SEVENSEG) && defined(USE_TM1637)
|
||||
feature7 |= 0x20000000; // xdsp_15_tm1637.ino
|
||||
#endif
|
||||
// feature7 |= 0x20000000;
|
||||
// feature7 |= 0x40000000;
|
||||
// feature7 |= 0x80000000;
|
||||
|
@ -571,6 +571,9 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source)
|
||||
interlock_mutex = false;
|
||||
}
|
||||
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
power_t old_power = TasmotaGlobal.power;
|
||||
#endif // USE_DEVICE_GROUPS
|
||||
switch (state) {
|
||||
case POWER_OFF: {
|
||||
TasmotaGlobal.power &= (POWER_MASK ^ mask);
|
||||
@ -582,7 +585,7 @@ void ExecuteCommandPower(uint32_t device, uint32_t state, uint32_t source)
|
||||
TasmotaGlobal.power ^= mask;
|
||||
}
|
||||
#ifdef USE_DEVICE_GROUPS
|
||||
if (SRC_REMOTE != source && SRC_RETRY != source) {
|
||||
if (TasmotaGlobal.power != old_power && SRC_REMOTE != source && SRC_RETRY != source) {
|
||||
if (Settings.flag4.multiple_device_groups) // SetOption88 - Enable relays in separate device groups
|
||||
SendDeviceGroupMessage(device - 1, DGR_MSGTYP_UPDATE, DGR_ITEM_POWER, (TasmotaGlobal.power >> (device - 1)) & 1 | 0x01000000); // Explicitly set number of relays to one
|
||||
else
|
||||
@ -761,8 +764,6 @@ bool MqttShowSensor(void)
|
||||
for (uint32_t i = 0; i < MAX_SWITCHES; i++) {
|
||||
#ifdef USE_TM1638
|
||||
if (PinUsed(GPIO_SWT1, i) || (PinUsed(GPIO_TM16CLK) && PinUsed(GPIO_TM16DIO) && PinUsed(GPIO_TM16STB))) {
|
||||
#elif defined(USE_TM1637)
|
||||
if (PinUsed(GPIO_TM1637_CLK) && PinUsed(GPIO_TM1637_DIO)) {
|
||||
#else
|
||||
if (PinUsed(GPIO_SWT1, i)) {
|
||||
#endif // USE_TM1638
|
||||
@ -1651,6 +1652,7 @@ void GpioInit(void)
|
||||
ValidSpiPinUsed(GPIO_ST7789_DC) || // ST7789 CS may be omitted so chk DC too
|
||||
ValidSpiPinUsed(GPIO_ST7789_CS) ||
|
||||
(ValidSpiPinUsed(GPIO_SSD1331_CS) && ValidSpiPinUsed(GPIO_SSD1331_DC)) ||
|
||||
(ValidSpiPinUsed(GPIO_TM1637_CLK) && ValidSpiPinUsed(GPIO_TM1637_DIO)) ||
|
||||
ValidSpiPinUsed(GPIO_SDCARD_CS)
|
||||
);
|
||||
// If SPI_CS and/or SPI_DC is used they must be valid
|
||||
|
@ -202,7 +202,6 @@
|
||||
#define USE_LMT01 // Add support for TI LMT01 temperature sensor, count pulses on single GPIO (+0k5 code)
|
||||
//#define USE_WIEGAND // Add support for 24/26/32/34 bit RFID Wiegand interface (D0/D1) (+1k7 code)
|
||||
#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
|
||||
#define USE_TM1637 // Add support for TM1637 seven-segment display
|
||||
#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
|
||||
//#define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
|
||||
//#define USE_TX20_WIND_SENSOR // Add support for La Crosse TX20 anemometer (+2k6/0k8 code)
|
||||
@ -319,6 +318,7 @@
|
||||
#define USE_DISPLAY_RA8876 // [DisplayModel 10]
|
||||
#define USE_DISPLAY_ST7789 // [DisplayModel 12] Enable ST7789 module
|
||||
#define USE_DISPLAY_SSD1331 // [DisplayModel 14] Enable SSD1331 module
|
||||
#define USE_DISPLAY_TM1637 // [DisplayModel 15] Enable TM1637 module
|
||||
|
||||
#undef DEBUG_THEO // Disable debug code
|
||||
#undef USE_DEBUG_DRIVER // Disable debug code
|
||||
@ -433,7 +433,6 @@
|
||||
#undef USE_MAX31855 // Disable MAX31855 K-Type thermocouple sensor using softSPI
|
||||
#undef USE_MAX31865 // Disable support for MAX31865 RTD sensors using softSPI
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_TM1637 // Disable support for TM1637 seven-segment display
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer
|
||||
#undef USE_TX23_WIND_SENSOR // Disable support for La Crosse TX23 anemometer
|
||||
@ -581,7 +580,6 @@
|
||||
#undef USE_IR_REMOTE // Disable IR driver
|
||||
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_TM1637 // Disable support for TM1637 seven-segment display
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer
|
||||
#undef USE_TX23_WIND_SENSOR // Disable support for La Crosse TX23 anemometer
|
||||
@ -719,7 +717,6 @@
|
||||
#undef USE_IR_REMOTE // Disable IR driver
|
||||
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_TM1637 // Disable support for TM1637 seven-segment display
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer
|
||||
#undef USE_TX23_WIND_SENSOR // Disable support for La Crosse TX23 anemometer
|
||||
@ -862,7 +859,6 @@
|
||||
#undef USE_LMT01 // Disable support for TI LMT01 temperature sensor, count pulses on single GPIO (+0k5 code)
|
||||
#undef USE_IR_REMOTE // Disable IR driver
|
||||
#undef USE_TM1638 // Disable support for TM1638 switches copying Switch1 .. Switch8
|
||||
#undef USE_TM1637 // Disable support for TM1637 seven-segment display
|
||||
#undef USE_HX711 // Disable support for HX711 load cell
|
||||
#undef USE_TX20_WIND_SENSOR // Disable support for La Crosse TX20 anemometer
|
||||
#undef USE_TX23_WIND_SENSOR // Disable support for La Crosse TX23 anemometer
|
||||
|
@ -53,7 +53,6 @@ enum UserSelectablePins {
|
||||
GPIO_SDM120_TX, GPIO_SDM120_RX, // SDM120 Serial interface
|
||||
GPIO_SDM630_TX, GPIO_SDM630_RX, // SDM630 Serial interface
|
||||
GPIO_TM16CLK, GPIO_TM16DIO, GPIO_TM16STB, // TM1638 interface
|
||||
GPIO_TM1637_CLK, GPIO_TM1637_DIO, // TM1637 interface
|
||||
GPIO_MP3_DFR562, // RB-DFR-562, DFPlayer Mini MP3 Player
|
||||
GPIO_HX711_SCK, GPIO_HX711_DAT, // HX711 Load Cell interface
|
||||
GPIO_TX2X_TXD_BLACK, // TX20/TX23 Transmission Pin
|
||||
@ -143,6 +142,7 @@ enum UserSelectablePins {
|
||||
GPIO_RA8876_CS,
|
||||
GPIO_ST7789_CS, GPIO_ST7789_DC,
|
||||
GPIO_SSD1331_CS, GPIO_SSD1331_DC,
|
||||
GPIO_TM1637_CLK, GPIO_TM1637_DIO,
|
||||
GPIO_SDCARD_CS,
|
||||
GPIO_ROT1A_NP, GPIO_ROT1B_NP, // Rotary switch
|
||||
GPIO_ADC_PH, // Analog PH Sensor
|
||||
@ -226,7 +226,6 @@ const char kSensorNames[] PROGMEM =
|
||||
D_SENSOR_SDM120_TX "|" D_SENSOR_SDM120_RX "|"
|
||||
D_SENSOR_SDM630_TX "|" D_SENSOR_SDM630_RX "|"
|
||||
D_SENSOR_TM1638_CLK "|" D_SENSOR_TM1638_DIO "|" D_SENSOR_TM1638_STB "|"
|
||||
D_SENSOR_TM1637_CLK "|" D_SENSOR_TM1637_DIO "|"
|
||||
D_SENSOR_DFR562 "|"
|
||||
D_SENSOR_HX711_SCK "|" D_SENSOR_HX711_DAT "|"
|
||||
D_SENSOR_TX2X_TX "|"
|
||||
@ -312,6 +311,7 @@ const char kSensorNames[] PROGMEM =
|
||||
D_SENSOR_RA8876_CS "|"
|
||||
D_SENSOR_ST7789_CS "|" D_SENSOR_ST7789_DC "|"
|
||||
D_SENSOR_SSD1331_CS "|" D_SENSOR_SSD1331_DC "|"
|
||||
D_SENSOR_TM1637_CLK "|" D_SENSOR_TM1637_DIO "|"
|
||||
D_SENSOR_SDCARD_CS "|"
|
||||
D_SENSOR_ROTARY " A_n|" D_SENSOR_ROTARY " B_n|"
|
||||
D_SENSOR_ADC_PH "|"
|
||||
@ -431,6 +431,10 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
AGPIO(GPIO_SSD1331_CS),
|
||||
AGPIO(GPIO_SSD1331_DC),
|
||||
#endif // USE_DISPLAY_SSD1331
|
||||
#ifdef USE_DISPLAY_TM1637
|
||||
AGPIO(GPIO_TM1637_CLK),
|
||||
AGPIO(GPIO_TM1637_DIO),
|
||||
#endif // USE_DISPLAY_TM1637
|
||||
AGPIO(GPIO_BACKLIGHT), // Display backlight control
|
||||
AGPIO(GPIO_OLED_RESET), // OLED Display Reset
|
||||
#endif
|
||||
@ -531,14 +535,6 @@ const uint16_t kGpioNiceList[] PROGMEM = {
|
||||
AGPIO(GPIO_TM16DIO), // TM1638 Data I/O
|
||||
AGPIO(GPIO_TM16STB), // TM1638 Strobe
|
||||
#endif
|
||||
#ifdef USE_TM1637
|
||||
AGPIO(GPIO_TM1637_CLK), // TM1637 Clock
|
||||
AGPIO(GPIO_TM1637_DIO), // TM1637 Data I/O
|
||||
#endif
|
||||
#ifdef USE_TM1637
|
||||
GPIO_TM1637_CLK, // TM1637 Clock
|
||||
GPIO_TM1637_DIO, // TM1637 Data I/O
|
||||
#endif
|
||||
#ifdef USE_HX711
|
||||
AGPIO(GPIO_HX711_SCK), // HX711 Load Cell clock
|
||||
AGPIO(GPIO_HX711_DAT), // HX711 Load Cell data
|
||||
|
@ -64,6 +64,18 @@ const uint8_t DISPLAY_LOG_ROWS = 32; // Number of lines in display log
|
||||
#define D_CMND_DISP_WIDTH "Width"
|
||||
#define D_CMND_DISP_HEIGHT "Height"
|
||||
#define D_CMND_DISP_BLINKRATE "Blinkrate"
|
||||
#define D_CMND_DISP_CLEAR "Clear"
|
||||
#define D_CMND_DISP_NUMBER "Number"
|
||||
#define D_CMND_DISP_FLOAT "Float"
|
||||
#define D_CMND_DISP_NUMBERNC "NumberNC" // NC - "No Clear"
|
||||
#define D_CMND_DISP_FLOATNC "FloatNC" // NC - "No Clear"
|
||||
#define D_CMND_DISP_BRIGHTNESS "Brightness"
|
||||
#define D_CMND_DISP_RAW "Raw"
|
||||
#define D_CMND_DISP_LEVEL "Level"
|
||||
#define D_CMND_DISP_SEVENSEG_TEXT "SevensegText"
|
||||
#define D_CMND_DISP_SEVENSEG_TEXTNC "SevensegTextNC" // NC - "No Clear"
|
||||
#define D_CMND_DISP_SCROLLDELAY "ScrollDelay"
|
||||
#define D_CMND_DISP_CLOCK "Clock"
|
||||
|
||||
enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_EVERY_50_MSECOND, FUNC_DISPLAY_EVERY_SECOND,
|
||||
FUNC_DISPLAY_MODEL, FUNC_DISPLAY_MODE, FUNC_DISPLAY_POWER,
|
||||
@ -72,19 +84,27 @@ enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_E
|
||||
FUNC_DISPLAY_DRAW_CIRCLE, FUNC_DISPLAY_FILL_CIRCLE,
|
||||
FUNC_DISPLAY_DRAW_RECTANGLE, FUNC_DISPLAY_FILL_RECTANGLE,
|
||||
FUNC_DISPLAY_TEXT_SIZE, FUNC_DISPLAY_FONT_SIZE, FUNC_DISPLAY_ROTATION, FUNC_DISPLAY_DRAW_STRING,
|
||||
FUNC_DISPLAY_DIM, FUNC_DISPLAY_BLINKRATE };
|
||||
FUNC_DISPLAY_DIM, FUNC_DISPLAY_BLINKRATE, FUNC_DISPLAY_NUMBER, FUNC_DISPLAY_FLOAT,
|
||||
FUNC_DISPLAY_NUMBERNC, FUNC_DISPLAY_FLOATNC, FUNC_DISPLAY_BRIGHTNESS, FUNC_DISPLAY_RAW,
|
||||
FUNC_DISPLAY_LEVEL, FUNC_DISPLAY_SEVENSEG_TEXT, FUNC_DISPLAY_SEVENSEG_TEXTNC,
|
||||
FUNC_DISPLAY_SCROLLDELAY, FUNC_DISPLAY_CLOCK };
|
||||
|
||||
enum DisplayInitModes { DISPLAY_INIT_MODE, DISPLAY_INIT_PARTIAL, DISPLAY_INIT_FULL };
|
||||
|
||||
const char kDisplayCommands[] PROGMEM = D_PRFX_DISPLAY "|" // Prefix
|
||||
"|" D_CMND_DISP_MODEL "|" D_CMND_DISP_WIDTH "|" D_CMND_DISP_HEIGHT "|" D_CMND_DISP_MODE "|" D_CMND_DISP_REFRESH "|"
|
||||
D_CMND_DISP_DIMMER "|" D_CMND_DISP_COLS "|" D_CMND_DISP_ROWS "|" D_CMND_DISP_SIZE "|" D_CMND_DISP_FONT "|"
|
||||
D_CMND_DISP_ROTATE "|" D_CMND_DISP_TEXT "|" D_CMND_DISP_ADDRESS "|" D_CMND_DISP_BLINKRATE ;
|
||||
D_CMND_DISP_ROTATE "|" D_CMND_DISP_TEXT "|" D_CMND_DISP_ADDRESS "|" D_CMND_DISP_BLINKRATE "|" D_CMND_DISP_CLEAR "|"
|
||||
D_CMND_DISP_NUMBER "|" D_CMND_DISP_FLOAT "|" D_CMND_DISP_NUMBERNC "|" D_CMND_DISP_FLOATNC "|" D_CMND_DISP_BRIGHTNESS "|"
|
||||
D_CMND_DISP_RAW "|" D_CMND_DISP_LEVEL "|" D_CMND_DISP_SEVENSEG_TEXT "|" D_CMND_DISP_SEVENSEG_TEXTNC "|"
|
||||
D_CMND_DISP_SCROLLDELAY "|" D_CMND_DISP_CLOCK;
|
||||
|
||||
void (* const DisplayCommand[])(void) PROGMEM = {
|
||||
&CmndDisplay, &CmndDisplayModel, &CmndDisplayWidth, &CmndDisplayHeight, &CmndDisplayMode, &CmndDisplayRefresh,
|
||||
&CmndDisplayDimmer, &CmndDisplayColumns, &CmndDisplayRows, &CmndDisplaySize, &CmndDisplayFont,
|
||||
&CmndDisplayRotate, &CmndDisplayText, &CmndDisplayAddress, &CmndDisplayBlinkrate };
|
||||
&CmndDisplayRotate, &CmndDisplayText, &CmndDisplayAddress, &CmndDisplayBlinkrate, &CmndDisplayClear, &CmndDisplayNumber,
|
||||
&CmndDisplayFloat, &CmndDisplayNumberNC, &CmndDisplayFloatNC, &CmndDisplayBrightness, &CmndDisplayRaw,
|
||||
&CmndDisplayLevel, &CmndDisplaySevensegText, &CmndDisplaySevensegTextNC, &CmndDisplayScrollDelay, &CmndDisplayClock };
|
||||
|
||||
char *dsp_str;
|
||||
|
||||
@ -1432,6 +1452,105 @@ void CmndDisplayBlinkrate(void)
|
||||
ResponseCmndNumber(XdrvMailbox.payload);
|
||||
}
|
||||
|
||||
void CmndDisplayClear(void)
|
||||
{
|
||||
if (!renderer)
|
||||
XdspCall(FUNC_DISPLAY_CLEAR);
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayNumber(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_NUMBER);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayFloat(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_FLOAT);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayNumberNC(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_NUMBERNC);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayFloatNC(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_FLOATNC);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayBrightness(void)
|
||||
{
|
||||
bool result = false;
|
||||
if (!renderer) {
|
||||
result = XdspCall(FUNC_DISPLAY_BRIGHTNESS);
|
||||
}
|
||||
if(result) ResponseCmndNumber(XdrvMailbox.payload);
|
||||
ResponseCmndNumber(XdrvMailbox.payload);
|
||||
}
|
||||
|
||||
void CmndDisplayRaw(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_RAW);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayLevel(void)
|
||||
{
|
||||
bool result = false;
|
||||
if (!renderer) {
|
||||
result = XdspCall(FUNC_DISPLAY_LEVEL);
|
||||
}
|
||||
if(result) ResponseCmndNumber(XdrvMailbox.payload);
|
||||
ResponseCmndNumber(XdrvMailbox.payload);
|
||||
}
|
||||
|
||||
void CmndDisplaySevensegText(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_SEVENSEG_TEXT);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplaySevensegTextNC(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_SEVENSEG_TEXTNC);
|
||||
}
|
||||
ResponseCmndChar(XdrvMailbox.data);
|
||||
}
|
||||
|
||||
void CmndDisplayScrollDelay(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_SCROLLDELAY);
|
||||
}
|
||||
ResponseCmndNumber(XdrvMailbox.payload);
|
||||
}
|
||||
|
||||
void CmndDisplayClock(void)
|
||||
{
|
||||
if (!renderer) {
|
||||
XdspCall(FUNC_DISPLAY_CLOCK);
|
||||
}
|
||||
ResponseCmndNumber(XdrvMailbox.payload);
|
||||
}
|
||||
|
||||
void CmndDisplaySize(void)
|
||||
{
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= 4)) {
|
||||
|
509
tasmota/xdsp_15_tm1637.ino
Normal file
509
tasmota/xdsp_15_tm1637.ino
Normal file
@ -0,0 +1,509 @@
|
||||
/*
|
||||
xdsp_15_tm1637.ino - Support for TM1637 seven-segment display for Tasmota
|
||||
|
||||
Copyright (C) 2020 Ajith Vasudevan
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
This driver enables the display of numbers (both integers and floats) and basic text
|
||||
on the inexpensive TM1637-based seven-segment module. Raw segments can also be displayed.
|
||||
In addition, it is also possible to clear the display, set brightness (7 levels) and display
|
||||
a rudimentary bar graph.
|
||||
|
||||
To use, compile Tasmota with USE_SPI, USE_DISPLAY and USE_DISPLAY_TM1637
|
||||
This adds the following
|
||||
Pins:
|
||||
* TM 1637 DIO
|
||||
* TM 1637 CLK
|
||||
|
||||
Connect the TM1637 display module's DIO and CLK pins to any free GPIOs of the ESP8266 module
|
||||
and assign the above pins accordingly, from Tasmota's GUI.
|
||||
Once the device restarts the following commands become available:
|
||||
* TM1637Clear
|
||||
* TM1637Number
|
||||
* TM1637Float
|
||||
* TM1637Brightness
|
||||
* TM1637Raw
|
||||
* TM1637Level
|
||||
* TM1637Text
|
||||
|
||||
The usage of these commands are explained in code comments below.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef USE_DISPLAY
|
||||
#ifdef USE_DISPLAY_TM1637
|
||||
/*********************************************************************************************\
|
||||
* TM1637 support
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XDSP_15 15
|
||||
#include <TM1637TinyDisplay.h>
|
||||
|
||||
TM1637TinyDisplay *display;
|
||||
bool showClock = false;
|
||||
bool clock24 = false;
|
||||
uint8_t length = 4;
|
||||
uint8_t position = 0;
|
||||
bool leadingzeros = false;
|
||||
uint8_t length2 = 4;
|
||||
uint8_t precision = 4;
|
||||
|
||||
char msg[60];
|
||||
|
||||
|
||||
#define BRIGHTNESS_MIN 0
|
||||
#define BRIGHTNESS_MAX 7
|
||||
#define CMD_MAX_LEN 55
|
||||
#define LEVEL_MIN 0
|
||||
#define LEVEL_MAX 100
|
||||
|
||||
|
||||
#define D_CMND_TM1637 "TM1637"
|
||||
|
||||
const char S_TM1637_COMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":%s}";
|
||||
const char S_TM1637_COMMAND_SVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":\"%s\"}";
|
||||
const char S_TM1637_RAWCOMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":\"%d,%d,%d,%d\"}";
|
||||
const char S_TM1637_MESSAGE_SVALUE[] PROGMEM = "{\"" "\"%s\":\"%s\"}";
|
||||
const char kTM1637_Commands[] PROGMEM = "Clear|Number|NumberC|Float|FloatC|Brightness|Raw|Level|Text|TextC|ScrollDelay|Clock";
|
||||
|
||||
enum TM1637_Commands { // commands useable in console/MQTT or rules
|
||||
|
||||
CMND_TM1637_CLEAR, // Blanks the display, command: "TM1637Clear"
|
||||
|
||||
CMND_TM1637_NUMBER, // Display integer number (-999 to 9999). command e.g., "TM1637Number 1234"
|
||||
// Control 'leading zeros', 'length' and 'position' with "TM1637Number 1234, <leadingZeros>, <length>, <position>"
|
||||
// 'leading zeros' can be 1 or 0 (default), 'length' can be 1 to 4 (default), 'position' can be 0 (left-most) to 3 (right-most)
|
||||
|
||||
CMND_TM1637_NUMBERC, // Clear first, then display integer number (-999 to 9999). e.g., "TM1637NumberC 1234". Usage is same as above.
|
||||
|
||||
CMND_TM1637_FLOAT, // Display float (with decimal point) (0.001 to 9999.) command e.g., "TM1637Float 12.34"
|
||||
|
||||
CMND_TM1637_FLOATC, // Clear first, then display float (with decimal point) (0.001 to 9999.) command e.g., "TM1637FloatC 12.34"
|
||||
|
||||
CMND_TM1637_BRIGHTNESS, // Set brightness (1 to 7) command e.g., "TM1637Brightness 2" Note: Brightness takes effect only after a new display command is sent.
|
||||
|
||||
CMND_TM1637_RAW, // Takes 4 comma-separated integers (0-255) and displays raw segments
|
||||
// Each 7-segment display unit is represented by an 8-bit(8th bit for decimap point) number.
|
||||
// For example, the command "TM1637Raw 255, 255, 255, 255" would display "[8.8.8.8.]"
|
||||
|
||||
CMND_TM1637_LEVEL, // Display a horizontal bar graph (0-100) command e.g., "TM1637Level 50" will display [|||| ]
|
||||
|
||||
CMND_TM1637_TEXT, // Display basic text (scrolls if > 4 characters) command e.g., "TM1637Text ajith vasudevan"
|
||||
// Control 'length' and 'position' with "TM1637Text abcd, <length>, <position>"
|
||||
// 'length' can be 1 to 4 (default), 'position' can be 0 (left-most) to 3 (right-most)
|
||||
// Note: A caret sign '^' in the input text would be replaced by a "degrees" symbol. This is handy for displaying temperature!
|
||||
// Other Characters whose ASCII > 127 or ASCII < 32 would simply be blank.
|
||||
|
||||
CMND_TM1637_TEXTC, // Clear first, then display text. Usage is same as above.
|
||||
|
||||
CMND_TM1637_SCROLLDELAY, // Sets the speed of text scroll. Takes effect only after a new TEXT command is sent with 4 chars or more.
|
||||
|
||||
CMND_TM1637_CLOCK // Displays a clock. To start clock, command "TM1637Clock 1". To turn offclock, "TM1637Clock 0"
|
||||
};
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Init function
|
||||
\*********************************************************************************************/
|
||||
bool TM1637Init(void) {
|
||||
display = new TM1637TinyDisplay(Pin(GPIO_TM1637_CLK), Pin(GPIO_TM1637_DIO));
|
||||
display->setBrightness(BRIGHT_5);
|
||||
display->clear();
|
||||
if (!Settings.display_model) {
|
||||
Settings.display_model = XDSP_15;
|
||||
}
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("DSP: TM1637 display driver initialized"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Displays number without decimal, with/without leading zeros, specifying length
|
||||
* and position, optionally skipping clearing display before displaying the number.
|
||||
* commands: DisplayNumber num [,leading_zeros {0|1} [,length {1-4} [,position {0-3} ]]]
|
||||
* DisplayNumberNC num [,leading_zeros {0|1} [,length {1-4} [,position {0-3} ]]] // "NC" --> "No Clear"
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Number(bool clear) {
|
||||
char sNum[15]; char sLeadingZero[5]; char sLength[5]; char sPos[5];
|
||||
uint32_t num;
|
||||
|
||||
switch (ArgC())
|
||||
{
|
||||
case 4 :
|
||||
subStr(sPos, XdrvMailbox.data, ",", 4);
|
||||
position = atoi(sPos);
|
||||
case 3 :
|
||||
subStr(sLength, XdrvMailbox.data, ",", 3);
|
||||
length = atoi(sLength);
|
||||
case 2 :
|
||||
subStr(sLeadingZero, XdrvMailbox.data, ",", 2);
|
||||
leadingzeros = atoi(sLeadingZero);
|
||||
case 1 :
|
||||
subStr(sNum, XdrvMailbox.data, ",", 1);
|
||||
num = atoi(Trim(sNum));
|
||||
}
|
||||
|
||||
if(position > 3) position = 3;
|
||||
if(position < 0) position = 0;
|
||||
if((length <= 0) || (length > 4)) length = 4;
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: num=%d"), num);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: leadingzeros=%d"), leadingzeros);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length=%d"), length);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: position=%d"), position);
|
||||
|
||||
if(clear) display->clear();
|
||||
display->showNumber(num, leadingzeros, length, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Displays number with decimal, specifying precision and length,
|
||||
* optionally skipping clearing display before displaying the number.
|
||||
* commands: DisplayFloat num [,precision {0-4} [,length {1-4} [,position {0-3} ]]]
|
||||
* DisplayFloatNC num [,precision {0-4} [,length {1-4} [,position {0-3} ]]] // "NC" --> "No Clear"
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Float(bool clear) {
|
||||
|
||||
char sNum[15]; char sPrecision[5]; char sLength[5];
|
||||
float fnum = 0.0f;
|
||||
|
||||
switch (ArgC())
|
||||
{
|
||||
case 3 :
|
||||
subStr(sLength, XdrvMailbox.data, ",", 3);
|
||||
length2 = atoi(sLength);
|
||||
case 2 :
|
||||
subStr(sPrecision, XdrvMailbox.data, ",", 2);
|
||||
precision = atoi(sPrecision);
|
||||
case 1 :
|
||||
subStr(sNum, XdrvMailbox.data, ",", 1);
|
||||
fnum = atof(sNum);
|
||||
}
|
||||
|
||||
if((precision < 0) || (precision > 4)) precision = 4;
|
||||
if((length2 <= 0) || (length2 > 4)) length2 = 4;
|
||||
|
||||
char s[30];
|
||||
ext_snprintf_P(s, sizeof(s), PSTR("LOG: TM1637: num=%*_f"), 4, &fnum);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("%s"), s);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: precision=%d"), precision);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length2=%d"), length2);
|
||||
|
||||
if(clear) display->clear();
|
||||
display->showNumber(fnum, precision, length2, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Clears the display
|
||||
* Command: DisplayClear
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Clear(void) {
|
||||
display->clear();
|
||||
sprintf(msg, PSTR("Cleared"));
|
||||
XdrvMailbox.data = msg;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Displays a horizontal bar graph. Takes a percentage number (0-100) as input
|
||||
* Command: DisplayLevel level {0-100}
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Level(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if((val < LEVEL_MIN) || (val > LEVEL_MAX)) {
|
||||
sprintf(msg, PSTR("Level should be a number in the range [%d, %d]"), LEVEL_MIN, LEVEL_MAX);
|
||||
XdrvMailbox.data = msg;
|
||||
return false;
|
||||
}
|
||||
display->showLevel(val, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Display arbitrary data on the display module
|
||||
* Command: DisplayRaw a, b, c, d [, length {1-4} [, position {0-3}] ]
|
||||
* where a,b,c,d are 4 numbers in the range 0-255, representing a byte array,
|
||||
* each byte corresponding to a single digit. Within each byte, bit 0 is segment A,
|
||||
* bit 1 is segment B etc. The function may either set the entire display
|
||||
* or any desirable part using the length and position parameters.
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Raw(void) {
|
||||
uint8_t DATA[4] = { 0, 0, 0, 0 };
|
||||
|
||||
char as[5]; char bs[5]; char cs[5]; char ds[5]; char sLength[5]; char sPos[5];
|
||||
uint8_t a = 0;
|
||||
uint8_t b = 0;
|
||||
uint8_t c = 0;
|
||||
uint8_t d = 0;
|
||||
uint32_t position = 0;
|
||||
uint32_t length = 4;
|
||||
|
||||
|
||||
switch (ArgC())
|
||||
{
|
||||
case 6 :
|
||||
subStr(sPos, XdrvMailbox.data, ",", 6);
|
||||
position = atoi(sPos);
|
||||
case 5 :
|
||||
subStr(sLength, XdrvMailbox.data, ",", 5);
|
||||
length = atoi(sLength);
|
||||
case 4 :
|
||||
subStr(ds, XdrvMailbox.data, ",", 4);
|
||||
d = atoi(ds);
|
||||
case 3 :
|
||||
subStr(cs, XdrvMailbox.data, ",", 3);
|
||||
c = atoi(cs);
|
||||
case 2 :
|
||||
subStr(bs, XdrvMailbox.data, ",", 2);
|
||||
b = atoi(bs);
|
||||
case 1 :
|
||||
subStr(as, XdrvMailbox.data, ",", 1);
|
||||
a = atoi(as);
|
||||
}
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: a=%d"), a);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: b=%d"), b);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: c=%d"), c);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: d=%d"), d);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length=%d"), length);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: position=%d"), position);
|
||||
|
||||
DATA[0] = a;
|
||||
DATA[1] = b;
|
||||
DATA[2] = c;
|
||||
DATA[3] = d;
|
||||
display->setSegments(DATA, length, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Display a given string. If more than 4 characters, will scroll message on display
|
||||
* Text can be placed at arbitrary location on the display using the length and
|
||||
* position parameters without affecting the rest of the display.
|
||||
* Command: DisplaySevensegText text [, length {1-4} [, position {0-3}]]
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Text(bool clear) {
|
||||
if(XdrvMailbox.data_len > CMD_MAX_LEN) {
|
||||
sprintf(msg, PSTR("Text too long. Please limit text command length to %d"), CMD_MAX_LEN);
|
||||
XdrvMailbox.data = msg;
|
||||
return true;
|
||||
}
|
||||
char sString[CMD_MAX_LEN + 1]; char sLength[5]; char sPos[5];
|
||||
uint32_t position = 0;
|
||||
uint32_t length = 4;
|
||||
switch (ArgC())
|
||||
{
|
||||
case 3 :
|
||||
subStr(sPos, XdrvMailbox.data, ",", 3);
|
||||
position = atoi(sPos);
|
||||
case 2 :
|
||||
subStr(sLength, XdrvMailbox.data, ",", 2);
|
||||
length = atoi(sLength);
|
||||
case 1 :
|
||||
subStr(sString, XdrvMailbox.data, ",", 1);
|
||||
}
|
||||
|
||||
|
||||
if((length <= 0) || (length > 4)) length = 4;
|
||||
if(position > 3) position = 3;
|
||||
if(position < 0) position = 0;
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: string=%s"), sString);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length=%d"), length);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: pos=%d"), position);
|
||||
|
||||
for(uint32_t i; i<strlen(sString); i++) { // replacing caret '^' with ASCII value for degrees symbol
|
||||
if(sString[i] == '^') {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: Found Caret at %d"), i);
|
||||
sString[i] = 176;
|
||||
}
|
||||
}
|
||||
|
||||
if(clear) display->clear();
|
||||
display->showString_P(sString, length, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Sets brightness of the display. The setting takes effect when a command is given
|
||||
* to change the data being displayed.
|
||||
* Command: DisplayBrightness {0-7}
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Brightness(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if((val < BRIGHTNESS_MIN) || (val > BRIGHTNESS_MAX)) {
|
||||
sprintf(msg, PSTR("Brightness is a number in the range [%d, %d]"), BRIGHTNESS_MIN, BRIGHTNESS_MAX);
|
||||
XdrvMailbox.data = msg;
|
||||
return false;
|
||||
}
|
||||
display->setBrightness(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637ScrollDelay(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if(val == 0) val = 200;
|
||||
display->setScrolldelay(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Displays a clock.
|
||||
* Command: DisplayClock 1 // for 12-hour format
|
||||
* DisplayClock 2 // for 24-hour format
|
||||
* DisplayClock 0 // turn off clock
|
||||
\*********************************************************************************************/
|
||||
bool CmndTM1637Clock(void) {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: CmndTM1637Clock %d"), XdrvMailbox.payload);
|
||||
|
||||
showClock = XdrvMailbox.payload;
|
||||
if(XdrvMailbox.payload > 1) clock24 = true;
|
||||
else if(XdrvMailbox.payload == 1) clock24 = false;
|
||||
if(!showClock) {
|
||||
display->clear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* refreshes the time on if clock is displayed
|
||||
\*********************************************************************************************/
|
||||
void showTime() {
|
||||
uint8_t hr = RtcTime.hour;
|
||||
uint8_t mn = RtcTime.minute;
|
||||
|
||||
if(!clock24) {
|
||||
if(hr > 12) hr -= 12;
|
||||
}
|
||||
if((millis() % 1000) > 500) display->showNumber(1.0f * hr + ((float)RtcTime.minute)/100.0f, 2, 4, 0);
|
||||
else display->showNumber(100 * hr + RtcTime.minute);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* This function is called for all TM1637 Display functions.
|
||||
\*********************************************************************************************/
|
||||
bool TM1637Cmd(uint8_t fn) {
|
||||
bool result = false;
|
||||
switch (fn) {
|
||||
case FUNC_DISPLAY_CLEAR:
|
||||
result = CmndTM1637Clear();
|
||||
break;
|
||||
case FUNC_DISPLAY_NUMBER :
|
||||
result = CmndTM1637Number(true);
|
||||
break;
|
||||
case FUNC_DISPLAY_NUMBERNC :
|
||||
result = CmndTM1637Number(false);
|
||||
break;
|
||||
case FUNC_DISPLAY_FLOAT :
|
||||
result = CmndTM1637Float(true);
|
||||
break;
|
||||
case FUNC_DISPLAY_FLOATNC :
|
||||
result = CmndTM1637Float(false);
|
||||
break;
|
||||
case FUNC_DISPLAY_BRIGHTNESS:
|
||||
result = CmndTM1637Brightness();
|
||||
break;
|
||||
case FUNC_DISPLAY_RAW:
|
||||
result = CmndTM1637Raw();
|
||||
break;
|
||||
case FUNC_DISPLAY_LEVEL:
|
||||
result = CmndTM1637Level();
|
||||
break;
|
||||
case FUNC_DISPLAY_SEVENSEG_TEXT:
|
||||
result = CmndTM1637Text(true);
|
||||
break;
|
||||
case FUNC_DISPLAY_SEVENSEG_TEXTNC:
|
||||
result = CmndTM1637Text(false);
|
||||
break;
|
||||
case FUNC_DISPLAY_SCROLLDELAY:
|
||||
result = CmndTM1637ScrollDelay();
|
||||
break;
|
||||
case FUNC_DISPLAY_CLOCK:
|
||||
result = CmndTM1637Clock();
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool Xdsp15(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (FUNC_DISPLAY_INIT_DRIVER == function) {
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: FUNC_DISPLAY_INIT_DRIVER"));
|
||||
result = TM1637Init(); // init
|
||||
}
|
||||
else if (XDSP_15 == Settings.display_model) {
|
||||
switch (function) {
|
||||
case FUNC_DISPLAY_MODEL:
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: FUNC_DISPLAY_MODEL"));
|
||||
result = true;
|
||||
break;
|
||||
case FUNC_DISPLAY_INIT:
|
||||
CmndTM1637Clear();
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: FUNC_DISPLAY_INIT"));
|
||||
break;
|
||||
case FUNC_DISPLAY_DRAW_STRING:
|
||||
sprintf(msg, PSTR("For TM1637, please use DisplaySevenSegText instead of DisplayText"));
|
||||
XdrvMailbox.data = msg;
|
||||
result = true;
|
||||
break;
|
||||
case FUNC_DISPLAY_SEVENSEG_TEXT:
|
||||
case FUNC_DISPLAY_CLEAR:
|
||||
case FUNC_DISPLAY_NUMBER:
|
||||
case FUNC_DISPLAY_FLOAT:
|
||||
case FUNC_DISPLAY_NUMBERNC:
|
||||
case FUNC_DISPLAY_FLOATNC:
|
||||
case FUNC_DISPLAY_BRIGHTNESS:
|
||||
case FUNC_DISPLAY_RAW:
|
||||
case FUNC_DISPLAY_LEVEL:
|
||||
case FUNC_DISPLAY_SEVENSEG_TEXTNC:
|
||||
case FUNC_DISPLAY_SCROLLDELAY:
|
||||
case FUNC_DISPLAY_CLOCK:
|
||||
result = TM1637Cmd(function);
|
||||
break;
|
||||
case FUNC_DISPLAY_EVERY_50_MSECOND:
|
||||
if(showClock) {
|
||||
showTime();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_DISPLAY_TM1637
|
||||
#endif // USE_DISPLAY
|
@ -1,355 +0,0 @@
|
||||
/*
|
||||
xsns_85_tm1637.ino - Support for TM1637 seven-segment display for Tasmota
|
||||
|
||||
Copyright (C) 2020 Ajith Vasudevan
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
This driver enables the display of numbers (both integers and floats) and basic text
|
||||
on the inexpensive TM1637-based seven-segment module. Raw segments can also be displayed.
|
||||
In addition, it is also possible to clear the display, set brightness (7 levels) and display
|
||||
a rudimentary bar graph.
|
||||
|
||||
To use, compile Tasmota with USE_DISPLAY_SEVENSEG and USE_TM1637
|
||||
This adds the following
|
||||
Pins:
|
||||
* TM 1637 DIO
|
||||
* TM 1637 CLK
|
||||
|
||||
Connect the TM1637 display module's DIO and CLK pins to any free GPIOs of the ESP8266 module
|
||||
and assign the above pins accordingly, from Tasmota's GUI.
|
||||
Once the device restarts the following commands become available:
|
||||
* TM1637Clear
|
||||
* TM1637Number
|
||||
* TM1637Float
|
||||
* TM1637Brightness
|
||||
* TM1637Raw
|
||||
* TM1637Level
|
||||
* TM1637Text
|
||||
|
||||
The usage of these commands are explained in code comments below.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef USE_DISPLAY_SEVENSEG
|
||||
#ifdef USE_TM1637
|
||||
/*********************************************************************************************\
|
||||
* TM1637 support
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XSNS_85 85
|
||||
#include <TM1637TinyDisplay.h>
|
||||
|
||||
TM1637TinyDisplay *display;
|
||||
bool defaultResponse = true;
|
||||
bool isString = false;
|
||||
char command[CMDSZ];
|
||||
|
||||
|
||||
#define BRIGHTNESS_MIN 0
|
||||
#define BRIGHTNESS_MAX 7
|
||||
#define NUMBER_MIN -999
|
||||
#define NUMBER_MAX 9999
|
||||
#define FLOAT_MIN -999.0
|
||||
#define FLOAT_MAX 9999.0
|
||||
#define CMD_MAX_LEN 55
|
||||
#define LEVEL_MIN 0
|
||||
#define LEVEL_MAX 100
|
||||
|
||||
|
||||
#define D_CMND_TM1637 "TM1637"
|
||||
|
||||
const char S_TM1637_COMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":%s}";
|
||||
const char S_TM1637_COMMAND_SVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":\"%s\"}";
|
||||
const char S_TM1637_RAWCOMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_TM1637 "%s\":\"%d,%d,%d,%d\"}";
|
||||
const char S_TM1637_MESSAGE_SVALUE[] PROGMEM = "{\"" "\"%s\":\"%s\"}";
|
||||
const char kTM1637_Commands[] PROGMEM = "Clear|Number|NumberC|Float|Brightness|Raw|Level|Text|TextC|ScrollDelay";
|
||||
uint32_t len = strlen(D_CMND_TM1637);
|
||||
|
||||
|
||||
enum TM1637_Commands { // commands useable in console/MQTT or rules
|
||||
|
||||
CMND_TM1637_CLEAR, // Blanks the display, command: "TM1637Clear"
|
||||
|
||||
CMND_TM1637_NUMBER, // Display integer number (-999 to 9999). command e.g., "TM1637Number 1234"
|
||||
// Control 'leading zeros', 'length' and 'position' with "TM1637Number 1234, <leadingZeros>, <length>, <position>"
|
||||
// 'leading zeros' can be 1 or 0 (default), 'length' can be 1 to 4 (default), 'position' can be 0 (left-most) to 3 (right-most)
|
||||
|
||||
CMND_TM1637_NUMBERC, // Clear first, then display integer number (-999 to 9999). Usage is same as above.
|
||||
|
||||
CMND_TM1637_FLOAT, // Display float (with decimal point) (0.001 to 9999.) command e.g., "TM1637Float 12.34"
|
||||
|
||||
CMND_TM1637_BRIGHTNESS, // Set brightness (1 to 7) command e.g., "TM1637Brightness 2" Note: Brightness takes effect only after a new display command is sent.
|
||||
|
||||
CMND_TM1637_RAW, // Takes 4 comma-separated integers (0-255) and displays raw segments
|
||||
// Each 7-segment display unit is represented by an 8-bit(8th bit for decimap point) number.
|
||||
// For example, the command "TM1637Raw 255, 255, 255, 255" would display "[8.8.8.8.]"
|
||||
|
||||
CMND_TM1637_LEVEL, // Display a horizontal bar graph (0-100) command e.g., "TM1637Level 50" will display [|||| ]
|
||||
|
||||
CMND_TM1637_TEXT, // Display basic text (scrolls if > 4 characters) command e.g., "TM1637Text ajith vasudevan"
|
||||
// Control 'length' and 'position' with "TM1637Text abcd, <length>, <position>"
|
||||
// 'length' can be 1 to 4 (default), 'position' can be 0 (left-most) to 3 (right-most)
|
||||
// Note: A caret sign '^' in the input text would be replaced by a "degrees" symbol. This is handy for displaying temperature!
|
||||
// Other Characters whose ASCII > 127 or ASCII < 32 would simply be blank.
|
||||
|
||||
CMND_TM1637_TEXTC, // Clear first, then display text. Usage is same as above.
|
||||
|
||||
CMND_TM1637_SCROLLDELAY // Sets the speed of text scroll. Takes effect only after a new TEXT command is sent with 4 chars or more.
|
||||
};
|
||||
|
||||
bool TM1637Init(void) {
|
||||
display = new TM1637TinyDisplay(Pin(GPIO_TM1637_CLK), Pin(GPIO_TM1637_DIO));
|
||||
display->setBrightness(BRIGHT_5);
|
||||
display->clear();
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: initialized"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CmndTM1637Number(bool clear) {
|
||||
|
||||
char sNum[5]; char sLeadingZero[5]; char sLength[5]; char sPos[5];
|
||||
subStr(sNum, XdrvMailbox.data, ",", 1);
|
||||
subStr(sLeadingZero, XdrvMailbox.data, ",", 2);
|
||||
subStr(sLength, XdrvMailbox.data, ",", 3);
|
||||
subStr(sPos, XdrvMailbox.data, ",", 4);
|
||||
|
||||
uint32_t num = atoi(sNum);
|
||||
bool leadingZero = atoi(sLeadingZero);
|
||||
uint32_t length = atoi(sLength);
|
||||
uint32_t pos = atoi(sPos);
|
||||
|
||||
if((length <= 0) || (length > 4)) length = 4;
|
||||
if(pos > 4) pos = 4;
|
||||
if(pos < 0) pos = 0;
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: num=%d"), num);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: leadingZero=%d"), leadingZero);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length=%d"), length);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: pos=%d"), pos);
|
||||
|
||||
if(clear) display->clear();
|
||||
display->showNumber(num, leadingZero, length, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637Float(void) {
|
||||
float val = atof(XdrvMailbox.data);
|
||||
char msg[50];
|
||||
if((val < FLOAT_MIN) || (val > FLOAT_MAX)) {
|
||||
defaultResponse = false;
|
||||
float fmin = FLOAT_MIN;
|
||||
float fmax = FLOAT_MAX;
|
||||
char msg[50];
|
||||
ext_snprintf_P(msg, sizeof(msg), PSTR("Float should be in the range [%1_f, %1_f]"), &fmin, &fmax);
|
||||
Response_P(S_TM1637_MESSAGE_SVALUE, "Error", msg);
|
||||
return true;
|
||||
}
|
||||
display->showNumber(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637Clear(void) {
|
||||
display->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637Level(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if((val < LEVEL_MIN) || (val > LEVEL_MAX)) {
|
||||
defaultResponse = false;
|
||||
char msg[45];
|
||||
sprintf(msg, PSTR("Level should be a number in the range [%d, %d]"), LEVEL_MIN, LEVEL_MAX);
|
||||
Response_P(S_TM1637_MESSAGE_SVALUE, "Error", msg);
|
||||
return true;
|
||||
}
|
||||
display->showLevel(val, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637Raw(void) {
|
||||
uint8_t DATA[1][4] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00 }
|
||||
};
|
||||
|
||||
char a[5]; char b[5]; char c[5]; char d[5];
|
||||
subStr(a, XdrvMailbox.data, ",", 1);
|
||||
subStr(b, XdrvMailbox.data, ",", 2);
|
||||
subStr(c, XdrvMailbox.data, ",", 3);
|
||||
subStr(d, XdrvMailbox.data, ",", 4);
|
||||
|
||||
uint16_t a1 = atoi(a);
|
||||
uint16_t b1 = atoi(b);
|
||||
uint16_t c1 = atoi(c);
|
||||
uint16_t d1 = atoi(d);
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: a1=%d"), a1);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: b1=%d"), b1);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: c1=%d"), c1);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: d1=%d"), d1);
|
||||
|
||||
DATA[0][0] = a1;
|
||||
DATA[0][1] = b1;
|
||||
DATA[0][2] = c1;
|
||||
DATA[0][3] = d1;
|
||||
defaultResponse = false;
|
||||
Response_P(S_TM1637_RAWCOMMAND_NVALUE, command, a1, b1, c1, d1);
|
||||
display->showAnimation_P(DATA, FRAMES(DATA), TIME_MS(150));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CmndTM1637Text(bool clear) {
|
||||
char sString[CMD_MAX_LEN + 1]; char sLength[5]; char sPos[5];
|
||||
subStr(sString, XdrvMailbox.data, ",", 1);
|
||||
subStr(sLength, XdrvMailbox.data, ",", 2);
|
||||
subStr(sPos, XdrvMailbox.data, ",", 3);
|
||||
|
||||
uint32_t length = atoi(sLength);
|
||||
uint32_t pos = atoi(sPos);
|
||||
|
||||
if((length <= 0) || (length > 4)) length = 4;
|
||||
if(pos > 4) pos = 4;
|
||||
if(pos < 0) pos = 0;
|
||||
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: string=%s"), sString);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: length=%d"), length);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: pos=%d"), pos);
|
||||
|
||||
for(uint32_t i; i<strlen(sString); i++) { // replacing caret '^' with ASCII value for degrees symbol
|
||||
if(sString[i] == '^') sString[i] = 176;
|
||||
}
|
||||
|
||||
if(clear) display->clear();
|
||||
display->showString_P(sString, length, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CmndTM1637Brightness(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if((val < BRIGHTNESS_MIN) || (val > BRIGHTNESS_MAX)) {
|
||||
defaultResponse = false;
|
||||
char msg[45];
|
||||
sprintf(msg, PSTR("Brightness is a number in the range [%d, %d]"), BRIGHTNESS_MIN, BRIGHTNESS_MAX);
|
||||
Response_P(S_TM1637_MESSAGE_SVALUE, "Error", msg);
|
||||
return true;
|
||||
}
|
||||
display->setBrightness(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CmndTM1637ScrollDelay(void) {
|
||||
uint16_t val = XdrvMailbox.payload;
|
||||
if(val == 0) val = 200;
|
||||
display->setScrolldelay(val);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TM1637Cmd(void) {
|
||||
bool result = false;
|
||||
uint32_t command_code = -1;
|
||||
if (!strncasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_TM1637), len)) {
|
||||
command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic + len, kTM1637_Commands);
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("LOG: TM1637: command_code: %d params: %s"), command_code, XdrvMailbox.data);
|
||||
}
|
||||
if(command_code < 0) {
|
||||
return result;
|
||||
}
|
||||
if(XdrvMailbox.data_len > CMD_MAX_LEN) {
|
||||
char msg[45];
|
||||
sprintf(msg, PSTR("Command too long. Should be less than %d characters long"), CMD_MAX_LEN);
|
||||
Response_P(S_TM1637_MESSAGE_SVALUE, "Error", msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
switch (command_code) {
|
||||
case CMND_TM1637_CLEAR:
|
||||
defaultResponse = false;
|
||||
result = CmndTM1637Clear();
|
||||
Response_P(S_TM1637_MESSAGE_SVALUE, "Message", "Cleared");
|
||||
break;
|
||||
case CMND_TM1637_NUMBER :
|
||||
result = CmndTM1637Number(false);
|
||||
break;
|
||||
case CMND_TM1637_NUMBERC :
|
||||
result = CmndTM1637Number(true);
|
||||
break;
|
||||
case CMND_TM1637_FLOAT :
|
||||
result = CmndTM1637Float();
|
||||
break;
|
||||
case CMND_TM1637_BRIGHTNESS:
|
||||
result = CmndTM1637Brightness();
|
||||
break;
|
||||
case CMND_TM1637_RAW:
|
||||
isString = true;
|
||||
result = CmndTM1637Raw();
|
||||
break;
|
||||
case CMND_TM1637_LEVEL:
|
||||
result = CmndTM1637Level();
|
||||
break;
|
||||
case CMND_TM1637_TEXT:
|
||||
isString = true;
|
||||
result = CmndTM1637Text(false);
|
||||
break;
|
||||
case CMND_TM1637_TEXTC:
|
||||
isString = true;
|
||||
result = CmndTM1637Text(true);
|
||||
break;
|
||||
case CMND_TM1637_SCROLLDELAY:
|
||||
isString = true;
|
||||
result = CmndTM1637ScrollDelay();
|
||||
break;
|
||||
}
|
||||
|
||||
if(defaultResponse) {
|
||||
if(isString) Response_P(S_TM1637_COMMAND_SVALUE, command, XdrvMailbox.data);
|
||||
else Response_P(S_TM1637_COMMAND_NVALUE, command, XdrvMailbox.data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool Xsns85(uint8_t function)
|
||||
{
|
||||
bool result = false;
|
||||
if (PinUsed(GPIO_TM1637_CLK) && PinUsed(GPIO_TM1637_DIO)) {
|
||||
switch (function) {
|
||||
case FUNC_PRE_INIT:
|
||||
TM1637Init(); // init
|
||||
break;
|
||||
case FUNC_COMMAND:
|
||||
defaultResponse = true; // resetting value for new cmnd
|
||||
isString = false; // resetting value for new cmmd
|
||||
result = TM1637Cmd();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_1637
|
||||
#endif // USE_DISPLAY_SEVENSEG
|
@ -209,7 +209,7 @@ a_features = [[
|
||||
"USE_INA219","USE_SHT3X","USE_MHZ19","USE_TSL2561",
|
||||
"USE_SENSEAIR","USE_PMS5003","USE_MGS","USE_NOVA_SDS",
|
||||
"USE_SGP30","USE_SR04","USE_SDM120","USE_SI1145",
|
||||
"USE_SDM630","USE_LM75AD","USE_APDS9960","USE_TM1638","USE_TM1637"
|
||||
"USE_SDM630","USE_LM75AD","USE_APDS9960","USE_TM1638"
|
||||
],[
|
||||
"USE_MCP230xx","USE_MPR121","USE_CCS811","USE_MPU6050",
|
||||
"USE_MCP230xx_OUTPUT","USE_MCP230xx_DISPLAYOUTPUT","USE_HLW8012","USE_CSE7766",
|
||||
@ -243,7 +243,7 @@ a_features = [[
|
||||
"USE_EZODO","USE_EZORGB","USE_EZOPMP","USE_AS608",
|
||||
"USE_SHELLY_DIMMER","USE_RC522","USE_FTC532","USE_DISPLAY_EPAPER_42",
|
||||
"USE_DISPLAY_ILI9488","USE_DISPLAY_SSD1351","USE_DISPLAY_RA8876","USE_DISPLAY_ST7789",
|
||||
"USE_DISPLAY_SSD1331","USE_UFILESYS","USE_TIMEPROP","USE_PID",
|
||||
"USE_DISPLAY_SSD1331","USE_DISPLAY_TM1637","USE_UFILESYS","USE_TIMEPROP","USE_PID",
|
||||
"USE_BS814A2","USE_SEESAW_SOIL","USE_WIEGAND","USE_NEOPOOL",
|
||||
"USE_TOF10120","","",""
|
||||
],[
|
||||
|
Loading…
x
Reference in New Issue
Block a user