1#include "main-header.h"
4#include "user_app_exe.h"
6static byte power_up_msg;
8static long power_up_sent;
16int powerup_delivered() {
20 return msg_active << 1 | power_up_msg;
24static void power_callback(
struct command *com,
struct command *reply) {
29 printf(
"Powerup message delivered.\r\n");
33 send_user_app_status();
35void check_power_on_loop() {
39 if (!(mculib_has_time_passed(10, &power_up_sent))) {
43 if ((delctr > 6) && (msg_active)) {
45 printf(
"powerup - cleared msgactive for retry\r\n");
47 send_power_up(POWERUP_LOOP);
50void send_power_up_now(
int reason) {
56 printf(
"No command space for powerup!!\r\n");
60 com->target = CLOUD_SERVER;
61 int rc = loader_get_last_reset_cause();
68 if (config_get_flag(CONFIG_FLAGS_POWER_SAVE)) {
78 printf(
"powerup msg failed to queue: %i\r\n", rc);
83void send_power_up(
int reason) {
88 send_power_up_now(reason);
int deliver_command(struct command *com, pkt_callback)
deliver a command to a module
void command_add_arg(struct command *com, const char *format,...)
adds an arg to a partially initialised command structure
struct command * alloc_command()
allocate a free command