2023-09-29 16:18:21 +00:00
|
|
|
#include <user_code.hpp>
|
2023-09-29 17:56:25 +00:00
|
|
|
|
2023-10-02 09:04:44 +00:00
|
|
|
/*
|
|
|
|
Environment Details
|
|
|
|
P0-P2: Fans
|
|
|
|
P3-P6: Lights
|
|
|
|
P7: Air Purifier
|
|
|
|
I0-I2: Fan Switch
|
|
|
|
*/
|
|
|
|
|
2023-09-29 16:18:21 +00:00
|
|
|
|
2023-09-30 11:09:03 +00:00
|
|
|
// Display Componets
|
2023-10-02 09:04:44 +00:00
|
|
|
NexText clock_txt = NexText(1,2,"clock");
|
|
|
|
NexDSButton lt_bt = NexDSButton(1, 3, "lt_bt");
|
|
|
|
NexDSButton fan_bt = NexDSButton(1, 4, "fan_bt");
|
|
|
|
NexDSButton puri_bt = NexDSButton(1, 5, "puri_bt");
|
|
|
|
NexButton up_bt = NexButton(1, 6, "up_bt");
|
|
|
|
NexButton down_bt = NexButton(1, 7, "down_bt");
|
|
|
|
NexButton mode_off_btn = NexButton(1, 8, "mode_off_btn");
|
|
|
|
NexButton mode_fan_btn = NexButton(1, 9, "mode_fan_btn");
|
|
|
|
NexButton mode_cool_btn = NexButton(1, 10, "mode_cool_btn");
|
|
|
|
NexButton fan_auto_btn = NexButton(1, 11, "fan_auto_btn");
|
|
|
|
NexButton fan_1_btn = NexButton(1, 12, "fan_1_btn");
|
|
|
|
NexButton fan_2_btn = NexButton(1, 13, "fan_2_btn");
|
|
|
|
NexButton fan_3_btn = NexButton(1, 14, "fan_3_btn");
|
|
|
|
|
2023-10-02 08:29:57 +00:00
|
|
|
|
2023-09-30 11:09:03 +00:00
|
|
|
// List of Component ID Message to listen to
|
|
|
|
NexTouch *nex_listen_list[] =
|
|
|
|
{
|
2023-10-02 09:04:44 +00:00
|
|
|
<_bt,
|
|
|
|
&fan_bt,
|
|
|
|
&puri_bt,
|
|
|
|
&up_bt,
|
|
|
|
&down_bt,
|
|
|
|
&mode_off_btn,
|
|
|
|
&mode_fan_btn,
|
|
|
|
&mode_cool_btn,
|
|
|
|
&fan_auto_btn,
|
|
|
|
&fan_1_btn,
|
|
|
|
&fan_2_btn,
|
|
|
|
&fan_3_btn,
|
2023-09-30 11:09:03 +00:00
|
|
|
NULL};
|
2023-09-30 09:29:16 +00:00
|
|
|
|
2023-09-29 17:06:49 +00:00
|
|
|
/*
|
|
|
|
This Code will run right after ESPMega PRO's
|
|
|
|
Peripheral Initialization Routine
|
|
|
|
*/
|
2023-09-29 17:37:31 +00:00
|
|
|
void user_pre_init()
|
|
|
|
{
|
2023-09-30 09:29:16 +00:00
|
|
|
nexInit();
|
2023-09-29 16:18:21 +00:00
|
|
|
}
|
2023-09-29 17:06:49 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
This code will run after every component is initialized
|
|
|
|
*/
|
2023-09-29 17:37:31 +00:00
|
|
|
void user_init()
|
|
|
|
{
|
2023-10-02 08:29:57 +00:00
|
|
|
ESPMega_EXTLCD.print("page dashboard");
|
2023-09-30 08:42:44 +00:00
|
|
|
ESPMega_EXTLCD.write(0xFF);
|
|
|
|
ESPMega_EXTLCD.write(0xFF);
|
|
|
|
ESPMega_EXTLCD.write(0xFF);
|
2023-10-02 09:04:44 +00:00
|
|
|
lt_bt.attachPop(lt_btn_cb, <_bt);
|
|
|
|
fan_bt.attachPop(fan_btn_cb, &fan_bt);
|
|
|
|
|
2023-09-29 16:18:21 +00:00
|
|
|
}
|
|
|
|
|
2023-09-29 17:06:49 +00:00
|
|
|
/*
|
|
|
|
This code will run once every event loop
|
|
|
|
*/
|
2023-09-29 17:37:31 +00:00
|
|
|
void user_loop()
|
|
|
|
{
|
2023-09-30 09:29:16 +00:00
|
|
|
nexLoop(nex_listen_list);
|
2023-09-29 16:18:21 +00:00
|
|
|
}
|
|
|
|
|
2023-09-29 17:06:49 +00:00
|
|
|
/*
|
|
|
|
This code will run when an input pin changed state
|
|
|
|
*/
|
2023-09-29 17:37:31 +00:00
|
|
|
void virtual_interrupt_user_callback(int pin, int state)
|
|
|
|
{
|
2023-09-29 16:18:21 +00:00
|
|
|
}
|
2023-09-29 17:06:49 +00:00
|
|
|
|
2023-09-30 09:29:16 +00:00
|
|
|
void pwm_changed_user_callback(int pin)
|
|
|
|
{
|
2023-10-02 09:04:44 +00:00
|
|
|
|
2023-09-30 08:42:44 +00:00
|
|
|
}
|
|
|
|
|
2023-09-29 17:06:49 +00:00
|
|
|
/*
|
2023-09-29 17:37:31 +00:00
|
|
|
This code will run every 15 seconds
|
2023-09-29 17:06:49 +00:00
|
|
|
*/
|
2023-09-29 17:37:31 +00:00
|
|
|
void timer_tick_callback()
|
|
|
|
{
|
2023-10-02 09:04:44 +00:00
|
|
|
|
2023-09-29 16:18:21 +00:00
|
|
|
}
|
2023-09-30 09:29:16 +00:00
|
|
|
|
2023-10-02 09:04:44 +00:00
|
|
|
void lt_btn_cb(void *comp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
void fan_btn_cb(void *comp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
void puri_btn_cb(void *comp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
void ac_temp_adj_btn_cb(void *comp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
void ac_mode_adj_btn_cb(void *comp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
void ac_fan_adj_btn_cb(void *comp) {
|
|
|
|
|
2023-09-30 09:29:16 +00:00
|
|
|
}
|