Fix gpio_log_serial_dimmer

This commit is contained in:
fvanroie 2021-04-26 02:44:20 +02:00
parent a1ae1f8d52
commit 67a0902d75

View File

@ -56,6 +56,14 @@ class TouchConfig : public ButtonConfig {
TouchConfig touchConfig(); TouchConfig touchConfig();
#endif #endif
void gpio_log_serial_dimmer(const char* command)
{
char buffer[32];
snprintf_P(buffer, sizeof(buffer), PSTR("Dimmer: %02x %02x %02x %02x"), command[0], command[1], command[2],
command[3]);
LOG_VERBOSE(TAG_GPIO, buffer);
}
#ifdef ARDUINO #ifdef ARDUINO
static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t buttonState) static void gpio_event_handler(AceButton* button, uint8_t eventType, uint8_t buttonState)
{ {
@ -278,13 +286,13 @@ void gpioSetup()
break; break;
case HASP_GPIO_SERIAL_DIMMER: case HASP_GPIO_SERIAL_DIMMER:
const char command[5] = "\xEF\x01\x4D\xA3"; // Start Lanbon Dimmer
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
Serial2.begin(115200, SERIAL_8N1, UART_PIN_NO_CHANGE, gpioConfig[i].pin); Serial2.begin(115200, SERIAL_8N1, UART_PIN_NO_CHANGE, gpioConfig[i].pin);
delay(20); delay(20);
const char command[5] = "\xEF\x01\x4D\xA3"; // Start Lanbon Dimmer
Serial2.print(command); Serial2.print(command);
gpio_log_serial_dimmer(command);
#endif #endif
gpio_log_serial_dimmer(command);
break; break;
} }
} }
@ -310,14 +318,6 @@ void gpioLoop(void)
{} {}
#endif // ARDUINO #endif // ARDUINO
void gpio_log_serial_dimmer(const char* command)
{
char buffer[32];
snprintf_P(buffer, sizeof(buffer), PSTR("Dimmer: %02x %02x %02x %02x"), command[0], command[1], command[2],
command[3]);
LOG_VERBOSE(TAG_GPIO, buffer);
}
/* ********************************* State Setters *************************************** */ /* ********************************* State Setters *************************************** */
void gpio_get_value(hasp_gpio_config_t gpio) void gpio_get_value(hasp_gpio_config_t gpio)