Some additions

* Add command Display to show all settings at once
 * Add toggle function RGBW lights (#3695, #3697)
 * Add user configurable GPIO02 and GPIO03 on H801 devices (#3692)
This commit is contained in:
Theo Arends 2018-09-05 18:01:15 +02:00
parent ed1fd55d7f
commit 35d0e502c4
5 changed files with 22 additions and 14 deletions

View File

@ -3,6 +3,9 @@
* Add Wifi channel number to state message (#3664) * Add Wifi channel number to state message (#3664)
* Add support for Shelly 1 and basic support for Shelly 2 - No energy monitoring yet (#2789) * Add support for Shelly 1 and basic support for Shelly 2 - No energy monitoring yet (#2789)
* Add network information to display start screen (#3704) * Add network information to display start screen (#3704)
* Add command Display to show all settings at once
* Add toggle function RGBW lights (#3695, #3697)
* Add user configurable GPIO02 and GPIO03 on H801 devices (#3692)
* *
* 6.2.1 20180905 * 6.2.1 20180905
* Fix possible ambiguity on command parameters if StateText contains numbers only (#3656) * Fix possible ambiguity on command parameters if StateText contains numbers only (#3656)

View File

@ -2347,7 +2347,7 @@ void GpioInit()
if (mpin) pin[mpin] = i; if (mpin) pin[mpin] = i;
} }
if ((2 == pin[GPIO_TXD]) || (H801 == Settings.module)) Serial.set_tx(2); if ((2 == pin[GPIO_TXD]) || (H801 == Settings.module)) { Serial.set_tx(2); }
analogWriteRange(Settings.pwm_range); // Default is 1023 (Arduino.h) analogWriteRange(Settings.pwm_range); // Default is 1023 (Arduino.h)
analogWriteFreq(Settings.pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) analogWriteFreq(Settings.pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c)

View File

@ -136,9 +136,6 @@ enum ProgramSelectablePins {
GPIO_DI, // my92x1 PWM input GPIO_DI, // my92x1 PWM input
GPIO_DCKI, // my92x1 CLK input GPIO_DCKI, // my92x1 CLK input
GPIO_ARIRFRCV, // AliLux RF Receive input GPIO_ARIRFRCV, // AliLux RF Receive input
GPIO_MCP39_TX, // MCP39F501 Serial output
GPIO_MCP39_RX, // MCP39F501 Serial input
GPIO_MCP39_RST, // MCP39F501 Serial reset
GPIO_USER, // User configurable GPIO_USER, // User configurable
GPIO_MAX }; GPIO_MAX };
@ -550,8 +547,8 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
{ "H801", // Lixada H801 Wifi (ESP8266) { "H801", // Lixada H801 Wifi (ESP8266)
GPIO_USER, // GPIO00 E-FW Button GPIO_USER, // GPIO00 E-FW Button
GPIO_LED1, // GPIO01 Green LED GPIO_LED1, // GPIO01 Green LED
GPIO_USER, // GPIO02 RX and Optional sensor - Pin next to TX on the PCB GPIO_USER, // GPIO02 TX and Optional sensor - Pin next to TX on the PCB
GPIO_USER, // GPIO03 TX and Optional sensor - Pin next to GND on the PCB GPIO_USER, // GPIO03 RX and Optional sensor - Pin next to GND on the PCB
GPIO_PWM5, // GPIO04 W2 - PWM5 GPIO_PWM5, // GPIO04 W2 - PWM5
GPIO_LED2_INV, // GPIO05 Red LED GPIO_LED2_INV, // GPIO05 Red LED
0, 0, 0, 0, 0, 0, // Flash connection 0, 0, 0, 0, 0, 0, // Flash connection
@ -923,16 +920,16 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
}, },
{ "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/ { "Shelly 2", // Shelly2 (ESP8266 - 2MB) - https://shelly.cloud/shelly2/
0, 0,
GPIO_MCP39_RX, // GPIO01 MCP39F501 Serial input GPIO_TXD, // GPIO01 MCP39F501 Serial input
0, 0,
GPIO_MCP39_TX, // GPIO03 MCP39F501 Serial output GPIO_RXD, // GPIO03 MCP39F501 Serial output
GPIO_REL1, // GPIO04 GPIO_REL1, // GPIO04
GPIO_REL2, // GPIO05 GPIO_REL2, // GPIO05
0, 0, 0, 0, 0, 0, // Flash connection 0, 0, 0, 0, 0, 0, // Flash connection
GPIO_SWT1_NP, // GPIO12 GPIO_SWT1_NP, // GPIO12
0, 0,
GPIO_SWT2_NP, // GPIO14 GPIO_SWT2_NP, // GPIO14
GPIO_MCP39_RST, // GPIO15 MCP39F501 Reset 0, // GPIO15 MCP39F501 Reset
0, 0 0, 0
} }
}; };
@ -1002,7 +999,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, 0 0, 0
} }
{ "Ledunia", // Ledunia (ESP8266) - http://ledunia.de/ { "Ledunia", // Ledunia (ESP8266 - 32MB) - http://ledunia.de/
GPIO_USER, // GPIO00 (D0) GPIO_USER, // GPIO00 (D0)
GPIO_USER, // GPIO01 (D7) Serial RXD GPIO_USER, // GPIO01 (D7) Serial RXD
GPIO_USER, // GPIO02 (D2) GPIO_USER, // GPIO02 (D2)
@ -1019,4 +1016,4 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
} }
*/ */
#endif // _SONOFF_TEMPLATE_H_ #endif // _SONOFF_TEMPLATE_H_

View File

@ -49,10 +49,10 @@ enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_E
enum DisplayInitModes { DISPLAY_INIT_MODE, DISPLAY_INIT_PARTIAL, DISPLAY_INIT_FULL }; enum DisplayInitModes { DISPLAY_INIT_MODE, DISPLAY_INIT_PARTIAL, DISPLAY_INIT_FULL };
enum DisplayCommands { CMND_DISP_MODEL, CMND_DISP_MODE, CMND_DISP_REFRESH, CMND_DISP_DIMMER, CMND_DISP_COLS, CMND_DISP_ROWS, enum DisplayCommands { CMND_DISPLAY, CMND_DISP_MODEL, CMND_DISP_MODE, CMND_DISP_REFRESH, CMND_DISP_DIMMER, CMND_DISP_COLS, CMND_DISP_ROWS,
CMND_DISP_SIZE, CMND_DISP_FONT, CMND_DISP_ROTATE, CMND_DISP_TEXT, CMND_DISP_ADDRESS }; CMND_DISP_SIZE, CMND_DISP_FONT, CMND_DISP_ROTATE, CMND_DISP_TEXT, CMND_DISP_ADDRESS };
const char kDisplayCommands[] PROGMEM = const char kDisplayCommands[] PROGMEM =
D_CMND_DISP_MODEL "|" D_CMND_DISP_MODE "|" D_CMND_DISP_REFRESH "|" D_CMND_DISP_DIMMER "|" D_CMND_DISP_COLS "|" D_CMND_DISP_ROWS "|" "|" D_CMND_DISP_MODEL "|" 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_SIZE "|" D_CMND_DISP_FONT "|" D_CMND_DISP_ROTATE "|" D_CMND_DISP_TEXT "|" D_CMND_DISP_ADDRESS ;
const char S_JSON_DISPLAY_COMMAND_VALUE[] PROGMEM = "{\"" D_CMND_DISPLAY "%s\":\"%s\"}"; const char S_JSON_DISPLAY_COMMAND_VALUE[] PROGMEM = "{\"" D_CMND_DISPLAY "%s\":\"%s\"}";
@ -898,6 +898,12 @@ boolean DisplayCommand()
if (-1 == command_code) { if (-1 == command_code) {
serviced = false; // Unknown command serviced = false; // Unknown command
} }
else if (CMND_DISPLAY == command_code) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_DISPLAY "\":{\"" D_CMND_DISP_MODEL "\":%d,\"" D_CMND_DISP_MODE "\":%d,\"" D_CMND_DISP_DIMMER "\":%d,\""
D_CMND_DISP_SIZE "\":%d,\"" D_CMND_DISP_FONT "\":%d,\"" D_CMND_DISP_ROTATE "\":%d,\"" D_CMND_DISP_REFRESH "\":%d,\"" D_CMND_DISP_COLS "\":[%d,%d],\"" D_CMND_DISP_ROWS "\":%d}}"),
Settings.display_model, Settings.display_mode, Settings.display_dimmer, Settings.display_size, Settings.display_font, Settings.display_rotate, Settings.display_refresh,
Settings.display_cols[0], Settings.display_cols[1], Settings.display_rows);
}
else if (CMND_DISP_MODEL == command_code) { else if (CMND_DISP_MODEL == command_code) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < DISPLAY_MAX_DRIVERS)) { if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < DISPLAY_MAX_DRIVERS)) {
uint8_t last_display_model = Settings.display_model; uint8_t last_display_model = Settings.display_model;

View File

@ -243,7 +243,8 @@ void MatrixPrintLog(uint8_t direction)
uint8_t space = 0; uint8_t space = 0;
uint8_t max_cols = (disp_log_buffer_cols < MTX_MAX_SCREEN_BUFFER) ? disp_log_buffer_cols : MTX_MAX_SCREEN_BUFFER; uint8_t max_cols = (disp_log_buffer_cols < MTX_MAX_SCREEN_BUFFER) ? disp_log_buffer_cols : MTX_MAX_SCREEN_BUFFER;
mtx_buffer[0] = '\0'; mtx_buffer[0] = '\0';
for (byte i = 0; i < max_cols; i++) { uint8_t i = 0;
while ((txt[i] != '\0') && (i < max_cols)) {
if (txt[i] == ' ') { if (txt[i] == ' ') {
space++; space++;
} else { } else {
@ -252,6 +253,7 @@ void MatrixPrintLog(uint8_t direction)
if (space < 2) { if (space < 2) {
strncat(mtx_buffer, (const char*)txt +i, 1); strncat(mtx_buffer, (const char*)txt +i, 1);
} }
i++;
} }
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer); snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION "[%s]"), mtx_buffer);