tamper detection

This commit is contained in:
Siwat Sirichai 2024-06-29 00:00:14 -07:00
parent 23911f60a4
commit 64564023ca
4 changed files with 29 additions and 4 deletions

View File

@ -15,7 +15,7 @@ board = wt32-eth01
framework = arduino
lib_deps = siwats/ESPMegaPROR3@^2.9.4
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"cud-3.0.4-duct"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' -DAC_TYPE=AC_TYPE_DUCTED
build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"cud-3.0.5-duct"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' -DAC_TYPE=AC_TYPE_DUCTED
; Ceiling A/C Variant (and newer ducted models)
[env:satitm-ceiling]
@ -24,4 +24,4 @@ board = wt32-eth01
framework = arduino
lib_deps = siwats/ESPMegaPROR3@^2.9.4
monitor_speed = 115200
build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"cud-3.0.4-ceiling"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' -DAC_TYPE=AC_TYPE_CEILING
build_flags = -DCORE_DEBUG_LEVEL=0 -DSW_VERSION='"cud-3.0.5-ceiling"' -DBOARD_MODEL='"ESPMegaPRO R3.3c"' -DAC_TYPE=AC_TYPE_CEILING

View File

@ -60,6 +60,7 @@
* Display Configuration *
***********************************************/
// UART Configuration
#define TAMPER_DETECTION
#define INTERNAL_DISPLAY_UART Serial
#define INTERNAL_DISPLAY_BAUDRATE 115200
#define DISPLAY_UART Serial1

View File

@ -122,6 +122,10 @@ void setup()
espmega.iot->registerMqttCallback(handle_mqtt_message);
cudDisplayOTA.begin("/cuddisp", &cudDisplay, espmega.webServer);
internalDisplayOTA.begin("/intdisp", espmega.display, espmega.webServer);
#ifdef TAMPER_DETECTION
espmega.display->registerPageChangeCallback(pageChangeCallback);
espmega.display->registerTouchCallback(touchCallback);
#endif
ESP_LOGI("CUD IoT OS", "Initialization Complete");
}
@ -150,4 +154,19 @@ void handle_input_change(uint8_t pin, bool state)
void handle_mqtt_message(char *topic, char *payload)
{
ESP_LOGD("CUD IoT OS", "MQTT Message Received: %s, %s", topic, payload);
}
}
#ifdef TAMPER_DETECTION
void pageChangeCallback(uint8_t page)
{
char buffer[10];
sprintf(buffer, "%d", page);
espmega.iot->publishRelative("/tamper/page", buffer);
}
void touchCallback(uint8_t page, uint8_t component, uint8_t touchType)
{
char buffer[20];
sprintf(buffer, "%d,%d,%d", page, component, touchType);
espmega.iot->publishRelative("/tamper/touch", buffer);
}
#endif

View File

@ -26,4 +26,9 @@ void setup();
void loop();
void send_stop_bytes(HardwareSerial &uart);
void handle_input_change(uint8_t pin, bool state);
void handle_mqtt_message(char *topic, char *payload);
void handle_mqtt_message(char *topic, char *payload);
#ifdef TAMPER_DETECTION
void pageChangeCallback(uint8_t page);
void touchCallback(uint8_t page, uint8_t component, uint8_t touchType);
#endif