Budul
July 21, 2025, 6:51pm
1
hi,
I have a simple firmware for the power module, everything works, now I would like to be able to send a command/value to the module. How do I do it the easiest way? Thank you
Hi, since the power module is externally powered, you might initialize radio so it will listen.
Take inspiration from generic FW where the power module is powered and there is radio event handler set
// static event_param_t flood_detector_event_param = {.next_pub = 0};
// twr_flood_detector_init(&flood_detector, TWR_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_A);
// twr_flood_detector_set_event_handler(&flood_detector, flood_detector_event_handler, &flood_detector_event_param);
// twr_flood_detector_set_update_interval(&flood_detector, FLOOD_DETECTOR_UPDATE_INTERVAL);
static twr_module_pir_t pir;
twr_module_pir_init(&pir);
twr_module_pir_set_event_handler(&pir, pir_event_handler, NULL);
#if MODULE_POWER
twr_radio_set_event_handler(radio_event_handler, NULL);
twr_module_power_init();
twr_led_strip_init(&led_strip.self, twr_module_power_get_led_strip_driver(), &led_strip_buffer);
twr_module_relay_init(&relay_0_0, TWR_MODULE_RELAY_I2C_ADDRESS_DEFAULT);
twr_module_relay_init(&relay_0_1, TWR_MODULE_RELAY_I2C_ADDRESS_ALTERNATE);
led_strip.update_task_id = twr_scheduler_register(led_strip_update_task, NULL, TWR_TICK_INFINITY);
#else
twr_module_battery_init();
Related:
Hi,
Yesterday I totaly drained my batteries in climate module. It works for about two weeks Yes, it is short lifetime… At this moment I am not sure if I made some changes which causes this abnormal battery consumption, or it is normal, because I am using listening mode.
I modified bcf-radio-climate-monitor example. I changed mode to “radio listening mode” and I modified some intervals. I am checking new values every 20s…
I know, that during some tests, I checked new values so f…