diff options
| author | xengineering <me@xengineering.eu> | 2025-04-02 20:43:29 +0200 | 
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-04-02 20:43:29 +0200 | 
| commit | d19fc7e34f783b343e77b757c4f37aaadb5b66ca (patch) | |
| tree | d90a0e37899f9852f43f9f96bd57127ca0c8b70e /fw/app/src | |
| parent | bd4b1f9eaf19dfc6f8fa6a7770f222582125326d (diff) | |
| download | iot-contact-d19fc7e34f783b343e77b757c4f37aaadb5b66ca.tar iot-contact-d19fc7e34f783b343e77b757c4f37aaadb5b66ca.tar.zst iot-contact-d19fc7e34f783b343e77b757c4f37aaadb5b66ca.zip  | |
fw: app: Fix native_sim build
To reduce the number of Kconfig options the network hack was added two
both boards - the native_sim and nucleo_f767zi one. It reboots the
device if the network connection cannot be established since this is a
known bug of the nucleo board.
Nevertheless it seems that for the native_sim board this command is not
defined. Since it is a Linux application this makes somehow sense.
This commit introduces the boolean Kconfig option
`IOT_CONTACT_NETWORK_HACK` which is only enabled for the nucleo board
fixing the native_sim build.
Diffstat (limited to 'fw/app/src')
| -rw-r--r-- | fw/app/src/syslog.c | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/fw/app/src/syslog.c b/fw/app/src/syslog.c index edc2839..e19a196 100644 --- a/fw/app/src/syslog.c +++ b/fw/app/src/syslog.c @@ -14,7 +14,10 @@  #include <zephyr/logging/log_ctrl.h>  #include <zephyr/logging/log_core.h>  #include <zephyr/net/conn_mgr_connectivity.h> + +#ifdef CONFIG_IOT_CONTACT_NETWORK_HACK  #include <zephyr/sys/reboot.h> +#endif  // CONFIG_IOT_CONTACT_NETWORK_HACK  LOG_MODULE_REGISTER(syslog); @@ -58,12 +61,17 @@ int init_syslog(void)  	LOG_DBG("Initializing syslog logging backend");  	LOG_INF("Waiting for network ..."); + +#ifdef CONFIG_IOT_CONTACT_NETWORK_HACK  	int ret = k_sem_take(&network_connected, NETWORK_BUG_DELAY);  	if (ret == -EAGAIN) {  		LOG_ERR("Could not connect to network - rebooting system");  		log_flush();  		sys_reboot(SYS_REBOOT_COLD);  	} +#else +	k_sem_take(&network_connected, K_FOREVER); +#endif  // CONFIG_IOT_CONTACT_NETWORK_HACK  	LOG_INF("Enabling syslog backend");  	const struct log_backend *backend = log_backend_net_get();  | 
