try and fix mqtt panic
This commit is contained in:
parent
dc206625bf
commit
1a25129495
3 changed files with 19 additions and 10 deletions
15
node1.c
15
node1.c
|
|
@ -15,7 +15,8 @@
|
|||
|
||||
// 5 sec loop is for testing
|
||||
// #define LOOP_INTERVAL_MS 5000
|
||||
#define LOOP_INTERVAL_MS 30000
|
||||
#define LOOP_INTERVAL_MS 10000
|
||||
// #define LOOP_INTERVAL_MS 30000
|
||||
|
||||
/**
|
||||
* Balcony Weather Station Node 1
|
||||
|
|
@ -35,17 +36,15 @@ bool comms_led_state = false;
|
|||
void comms_led_blink() {
|
||||
printf("COMMS LED BLINK COUNT: %d\n", comms_led_blink_count);
|
||||
comms_led_blink_count++;
|
||||
if(!comms_led_state) {
|
||||
gpio_put(16, true);
|
||||
comms_led_state = true;
|
||||
}
|
||||
comms_led_state = true;
|
||||
comms_led_off_time = make_timeout_time_ms(1000);
|
||||
gpio_put(16, comms_led_state);
|
||||
}
|
||||
|
||||
void comms_led_update() {
|
||||
if (comms_led_state && time_reached(comms_led_off_time)) {
|
||||
gpio_put(16, false);
|
||||
if (time_reached(comms_led_off_time)) {
|
||||
comms_led_state = false;
|
||||
gpio_put(16, comms_led_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +136,7 @@ static bool cb_30(__unused struct repeating_timer *t) {
|
|||
|
||||
int main() {
|
||||
stdio_init_all();
|
||||
watchdog_enable(60000, 1);
|
||||
|
||||
// Initialize communication LED
|
||||
comms_led_init();
|
||||
|
|
@ -158,5 +158,6 @@ int main() {
|
|||
sleep_us(100);
|
||||
tight_loop_contents();
|
||||
mqtt_client_do_network_stuff(&mqtt_config);
|
||||
watchdog_update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue