File tree Expand file tree Collapse file tree 4 files changed +15
-6
lines changed
samples/subsys/mgmt/hawkbit Expand file tree Collapse file tree 4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,10 @@ int hawkbit_init(void);
9292 *
9393 * @details The hawkbit_autohandler handles the whole process
9494 * in pre-determined time intervals.
95+ *
96+ * @param auto_reschedule If true, the handler will reschedule itself
9597 */
96- void hawkbit_autohandler (void );
98+ void hawkbit_autohandler (bool auto_reschedule );
9799
98100/**
99101 * @brief The hawkBit probe verify if there is some update to be performed.
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ CONFIG_DNS_SERVER2="192.168.1.1"
4747CONFIG_SHELL=y
4848CONFIG_HAWKBIT_SHELL=y
4949CONFIG_KERNEL_SHELL=y
50- CONFIG_SHELL_STACK_SIZE=4096
5150
5251#hawkBit polling mode
5352CONFIG_HAWKBIT_POLLING=y
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ int main(void)
8383
8484#if defined(CONFIG_HAWKBIT_POLLING )
8585 LOG_INF ("Starting hawkBit polling mode" );
86- hawkbit_autohandler ();
86+ hawkbit_autohandler (true );
8787#endif
8888
8989#if defined(CONFIG_HAWKBIT_MANUAL )
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ static hawkbit_config_device_data_cb_handler_t hawkbit_config_device_data_cb_han
148148static void autohandler (struct k_work * work );
149149
150150static K_WORK_DELAYABLE_DEFINE (hawkbit_work_handle , autohandler ) ;
151+ static K_WORK_DELAYABLE_DEFINE (hawkbit_work_handle_once , autohandler ) ;
151152
152153K_SEM_DEFINE (probe_sem , 1 , 1 );
153154
@@ -1526,10 +1527,17 @@ static void autohandler(struct k_work *work)
15261527 break ;
15271528 }
15281529
1529- k_work_reschedule (& hawkbit_work_handle , K_SECONDS (poll_sleep ));
1530+ if (k_work_delayable_from_work (work ) == & hawkbit_work_handle ) {
1531+ k_work_reschedule (& hawkbit_work_handle , K_SECONDS (poll_sleep ));
1532+ }
1533+ }
15301534}
15311535
1532- void hawkbit_autohandler (void )
1536+ void hawkbit_autohandler (bool auto_reschedule )
15331537{
1534- k_work_reschedule (& hawkbit_work_handle , K_NO_WAIT );
1538+ if (auto_reschedule ) {
1539+ k_work_reschedule (& hawkbit_work_handle , K_NO_WAIT );
1540+ } else {
1541+ k_work_reschedule (& hawkbit_work_handle_once , K_NO_WAIT );
1542+ }
15351543}
You can’t perform that action at this time.
0 commit comments