Add lightswitch to this firmware
This commit is contained in:
18
src/main.c
18
src/main.c
@ -6,6 +6,11 @@
|
||||
#include "mongoose-touch.h"
|
||||
#include "fonts/FreeSerifBold9pt7b.h"
|
||||
#include "fonts/FreeMonoBold9pt7b.h"
|
||||
#include "mgos_config.h"
|
||||
#include "buttons.h"
|
||||
#include "relays.h"
|
||||
#include "mqtt.h"
|
||||
#include "rpc.h"
|
||||
|
||||
struct screen_t *s_screen = NULL;
|
||||
|
||||
@ -62,18 +67,13 @@ void tft_demo(void)
|
||||
LOG(LL_INFO, ("Screen '%s' has %d widgets", s_screen->name, screen_get_num_widgets(s_screen)));
|
||||
}
|
||||
|
||||
static void mqtt_recv_cb(struct mg_connection *nc, const char *topic, int topic_len, const char *msg, int msg_len, void *user_data) {
|
||||
widget_network_recv();
|
||||
LOG(LL_INFO, ("topic='%.*s' msg='%.*s'", topic_len, topic, msg_len, msg));
|
||||
(void) nc;
|
||||
(void) user_data;
|
||||
}
|
||||
|
||||
|
||||
enum mgos_app_init_result mgos_app_init(void)
|
||||
{
|
||||
buttons_init(mgos_sys_config_get_app_buttons());
|
||||
relays_init(mgos_sys_config_get_app_relays());
|
||||
mqtt_init();
|
||||
rpc_init();
|
||||
backlight_init();
|
||||
mgos_mqtt_sub("/s/#", mqtt_recv_cb, NULL);
|
||||
|
||||
tft_demo();
|
||||
|
||||
|
Reference in New Issue
Block a user