This commit is contained in:
Siwat Sirichai 2023-10-26 23:32:46 +07:00
parent ac4213de4d
commit bbb6278c51
3 changed files with 17 additions and 7 deletions

View File

@ -23,4 +23,5 @@ lib_deps = siwats/ESPMegaPROR3@^1.3.0
robtillaart/FRAM_I2C@^0.6.1
esphome/ESPAsyncWebServer-esphome@^3.1.0
bblanchon/ArduinoJson@^6.21.3
monitor_speed = 115200
monitor_speed = 115200
monitor_port = COM26

View File

@ -14,7 +14,7 @@ uint8_t slot_minutes[TOTAL_SLOT + 1] = {0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30
#define elcd ESPMega_EXTLCD
// Link with Dual state button object with id 2 on page 1 named bt0
NexPicture lt_bt = NexPicture(1, 1, "lt_bt");
NexPicture av_bt = NexPicture(1, 3, "lt_bt");
NexPicture av_bt = NexPicture(1, 3, "av_bt");
NexButton left_bt = NexButton(1, 5, "left_bt");
NexButton right_bt = NexButton(1, 6, "right_bt");
NexPicture slot1 = NexPicture(1, 7, "slot1");
@ -36,7 +36,8 @@ NexTouch *nex_listen_list[] =
&slot3,
&slot4,
&slot5,
&left_bt,
&right_bt,
NULL};
bool light_group_state()
@ -51,6 +52,7 @@ bool light_group_state()
void lt_bt_cb(void *ptr)
{
Serial.println("ltcb");
bool state = !light_group_state();
for (int i = 0; i++; i <= 5)
pwm_set_state(i, state);
@ -58,11 +60,13 @@ void lt_bt_cb(void *ptr)
void av_bt_cb(void *ptr)
{
Serial.println("avcb");
pwm_toggle(3);
}
void left_bt_cb(void *ptr)
{
Serial.println("leftcb");
if(cycle_slot_start>0){
cycle_slot_start--;
write_time_slot();
@ -71,6 +75,7 @@ void left_bt_cb(void *ptr)
void right_bt_cb(void *ptr)
{
Serial.println("rightcb");
if(cycle_slot_start<TOTAL_SLOT-5){
cycle_slot_start++;
write_time_slot();
@ -98,10 +103,10 @@ void user_init()
send_stop_bit();
ESPMega_EXTLCD.print("page dashboard");
send_stop_bit();
left_bt.attachPop(left_bt_cb);
right_bt.attachPop(right_bt_cb);
lt_bt.attachPop(lt_bt_cb);
av_bt.attachPop(av_bt_cb);
left_bt.attachPop(left_bt_cb, &left_bt);
right_bt.attachPop(right_bt_cb, &right_bt);
lt_bt.attachPop(lt_bt_cb, &lt_bt);
av_bt.attachPop(av_bt_cb, &av_bt);
}
/*

View File

@ -31,6 +31,10 @@ void user_state_request_callback();
void meeting_state_callback(String topic, String payload);
void send_stop_bit();
void write_time_slot();
void av_bt_cb(void *ptr);
void lt_bt_cb(void *ptr);
void left_bt_cb(void *ptr);
void right_bt_cb(void *ptr);
extern char MQTT_BASE_TOPIC[];