Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: net 1-wire lpc1768 crypto clock web fram log
Diff: main/main.c
- Revision:
- 16:48ef9d43018b
- Parent:
- 15:f91462db6088
- Child:
- 17:13a1068dda70
--- a/main/main.c Mon Dec 31 19:21:02 2018 +0000
+++ b/main/main.c Wed Jan 02 18:13:50 2019 +0000
@@ -15,16 +15,18 @@
#include "settings.h"
#include "values.h"
#include "debounce.h"
+#include "fault.h"
int main()
{
+ FaultZone = FAULT_ZONE_INIT;
PeriphsInit();
SystemInit();
LedInit();
ClockInit();
LogInit(ClockTmUtc, 115200);
if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty
- if ( WatchdogInit()) goto end; //Reserves 1 FRAM byte for the program position
+ FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position
NetServerInit();
if (NtpClientInit()) goto end;
HttpServerInit();
@@ -34,18 +36,19 @@
DebounceInit();
if ( SettingsInit()) goto end;
if ( ValuesInit()) goto end;
+ WatchdogInit();
while (1)
{
- WatchdogThisProgramPosition = 1; WatchdogMain();
- WatchdogThisProgramPosition = 2; LogMain();
- WatchdogThisProgramPosition = 3; ClockMain();
- WatchdogThisProgramPosition = 4; NetServerMain();
- WatchdogThisProgramPosition = 5; NtpClientMain();
- WatchdogThisProgramPosition = 6; ValuesMain();
- WatchdogThisProgramPosition = 7; if ( OneWireMain()) break;
- WatchdogThisProgramPosition = 8; if ( DeviceMain()) break;
- WatchdogThisProgramPosition = 9; HeatingMain();
+ FaultZone = FAULT_ZONE_LOG; LogMain();
+ FaultZone = FAULT_ZONE_CLOCK; ClockMain();
+ FaultZone = FAULT_ZONE_NET; NetServerMain();
+ FaultZone = FAULT_ZONE_NONE; NtpClientMain();
+ FaultZone = FAULT_ZONE_NONE; ValuesMain();
+ FaultZone = FAULT_ZONE_NONE; if ( OneWireMain()) break;
+ FaultZone = FAULT_ZONE_NONE; if ( DeviceMain()) break;
+ FaultZone = FAULT_ZONE_NONE; HeatingMain();
+ FaultZone = FAULT_ZONE_NONE; WatchdogMain();
}
end: