sync
This commit is contained in:
@@ -14,6 +14,20 @@
|
||||
#include <audio.h>
|
||||
#include <io.h>
|
||||
#include <usb.h>
|
||||
#include <utils.h>
|
||||
|
||||
volatile static uint8_t reboot_code = 0;
|
||||
|
||||
void init_reboot_status()
|
||||
{
|
||||
reboot_code = get_reboot_status();
|
||||
if (reboot_code != 0)
|
||||
{
|
||||
LOG_INF("Device rebooted with status code: 0x%02x", reboot_code);
|
||||
}
|
||||
}
|
||||
|
||||
SYS_INIT(init_reboot_status, POST_KERNEL, 0);
|
||||
|
||||
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
|
||||
|
||||
@@ -24,25 +38,29 @@ int main(void)
|
||||
int rc;
|
||||
|
||||
rc = fs_init();
|
||||
if (rc < 0) {
|
||||
if (rc < 0)
|
||||
{
|
||||
LOG_ERR("Filesystem initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
if (rc < 0)
|
||||
{
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = usb_cdc_acm_init();
|
||||
if (rc < 0) {
|
||||
if (rc < 0)
|
||||
{
|
||||
LOG_ERR("USB initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = io_init();
|
||||
if (rc < 0) {
|
||||
if (rc < 0)
|
||||
{
|
||||
LOG_ERR("I/O initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
@@ -54,6 +72,11 @@ int main(void)
|
||||
LOG_INF("Confirmation of firmware image pending. Inform user...");
|
||||
audio_play("/lfs/sys/update");
|
||||
}
|
||||
else if (reboot_code == REBOOT_STATUS_FIRMWARE_CONFIRMED)
|
||||
{
|
||||
LOG_INF("Firmware was just confirmed in the last reboot. Playing confirmation sound.");
|
||||
audio_play("/lfs/sys/confirm");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INF("Firmware image already confirmed. No need to confirm again.");
|
||||
|
||||
Reference in New Issue
Block a user