robustness
This commit is contained in:
parent
4ebafa7cb7
commit
a6aaad3d93
|
@ -45,6 +45,10 @@ Peripheral Initialization Routine
|
||||||
void user_pre_init()
|
void user_pre_init()
|
||||||
{
|
{
|
||||||
nexInit();
|
nexInit();
|
||||||
|
memcpy(AC_LOCK_TOPIC, MQTT_BASE_TOPIC, 20);
|
||||||
|
strcat(AC_LOCK_TOPIC, "/ac/set/lock");
|
||||||
|
memcpy(AC_LOCK_REPORT_TOPIC, MQTT_BASE_TOPIC, 20);
|
||||||
|
strcat(AC_LOCK_REPORT_TOPIC, "/ac/lock");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,10 +58,6 @@ void user_init()
|
||||||
{
|
{
|
||||||
elcd.print("page dashboard");
|
elcd.print("page dashboard");
|
||||||
elcd_sendstop();
|
elcd_sendstop();
|
||||||
memcpy(AC_LOCK_TOPIC, MQTT_BASE_TOPIC, 20);
|
|
||||||
strcat(AC_LOCK_TOPIC, "/ac/set/lock");
|
|
||||||
memcpy(AC_LOCK_REPORT_TOPIC, MQTT_BASE_TOPIC, 20);
|
|
||||||
strcat(AC_LOCK_REPORT_TOPIC, "/ac/lock");
|
|
||||||
ac_lock = ESPMega_FRAM.read8(AC_LOCK_ADDRESS);
|
ac_lock = ESPMega_FRAM.read8(AC_LOCK_ADDRESS);
|
||||||
ac_lock = ac_lock > 1 ? 0 : ac_lock;
|
ac_lock = ac_lock > 1 ? 0 : ac_lock;
|
||||||
elcd.print("dashboard.pic=");
|
elcd.print("dashboard.pic=");
|
||||||
|
@ -273,7 +273,7 @@ void ac_lock_callback(String topic, String payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ac_lock_report() {
|
void ac_lock_report() {
|
||||||
//mqtt_client.publish(AC_LOCK_REPORT_TOPIC,ac_lock?"lock":"unlock");
|
mqtt_client.publish(AC_LOCK_REPORT_TOPIC,ac_lock?"lock":"unlock");
|
||||||
}
|
}
|
||||||
|
|
||||||
void elcd_sendstop() {
|
void elcd_sendstop() {
|
||||||
|
@ -295,7 +295,6 @@ void pwm_update_lcd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mqtt_connected_user_callback() {
|
void mqtt_connected_user_callback() {
|
||||||
Serial.println("User Subscribing");
|
|
||||||
mqtt.subscribe(String(AC_LOCK_TOPIC), ac_lock_callback);
|
mqtt.subscribe(String(AC_LOCK_TOPIC), ac_lock_callback);
|
||||||
ac_lock_report();
|
ac_lock_report();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue