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.
Dependents: oldheating gps motorhome heating
Revision 118:53430a2a2595, committed 2019-05-08
- Comitter:
- andrewboyson
- Date:
- Wed May 08 12:14:13 2019 +0000
- Parent:
- 117:4f1fe03715ca
- Child:
- 119:794e5985d6c8
- Commit message:
- Updated lpc1768 library
Changed in this revision
--- a/base/fault/web-fault-html.c Fri May 03 14:41:57 2019 +0000
+++ b/base/fault/web-fault-html.c Wed May 08 12:14:13 2019 +0000
@@ -3,7 +3,9 @@
#include "http.h"
#include "web-nav-base.h"
#include "web-add.h"
-#include "fault.h"
+#include "reset.h"
+#include "restart.h"
+#include "rsid.h"
void WebFaultHtml()
{
@@ -12,22 +14,28 @@
WebAddNav(FAULT_PAGE);
WebAddH1("Fault");
- WebAddH2("Last reset");
- int faultCause = FaultCauseGet();
+ WebAddH2("Last reset source id (RSID)");
+
+ WebAddLabelledLed("Power on" , RsidPor );
+ WebAddLabelledLed("External (includes semi-host)", RsidExtr);
+ WebAddLabelledLed("Watchdog" , RsidWdtr);
+ WebAddLabelledLed("Brown out" , RsidBodr);
+
+ WebAddH2("Last reset cause");
+ int faultCause = RestartGetLastCause();
char text[20];
- FaultCauseToString(faultCause, sizeof(text), text);
+ RestartCauseToString(faultCause, sizeof(text), text);
WebAddLabelledText("Reset cause", text);
- if (faultCause)
- {
- FaultZoneToString(FaultZoneGet(), sizeof(text), text);
- WebAddLabelledText("Occured in zone" , text);
- WebAddLabelledInt ("After point", FaultPointGet());
- WebAddInputButton ("Clear fault", "Clear", "/fault", "faultclear");
- }
- else
- {
- WebAddInputButton("Create test fault", "Test", "/fault", "faulttest");
- }
+ RestartZoneToString(RestartGetLastZone(), sizeof(text), text);
+ WebAddLabelledText("Occured in zone" , text);
+ WebAddLabelledInt ("After point", RestartGetLastPoint());
+
+ WebAddH2("Test reset");
+ WebAddInputButton("Create hard fault", "Test", "/fault", "faulttest");
+
+ WebAddH2("Accept last reset");
+ WebAddLabelledLed("Reset accepted", ResetAccepted);
+ WebAddInputButton("Accept reset", "Accept", "/fault", "faultclear");
WebAddEnd();
}
--- a/base/fault/web-fault-query.c Fri May 03 14:41:57 2019 +0000
+++ b/base/fault/web-fault-query.c Wed May 08 12:14:13 2019 +0000
@@ -1,5 +1,8 @@
+#include <stdbool.h>
+
#include "http.h"
-#include "fault.h"
+#include "reset.h"
+#include "restart.h"
void WebFaultQuery(char* pQuery)
{
@@ -9,11 +12,11 @@
char* pValue;
pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
- if (HttpSameStr(pName, "faultclear")) FaultReset();
+ if (HttpSameStr(pName, "faultclear")) ResetAccepted = true;
if (HttpSameStr(pName, "faulttest" ))
{
- FaultPoint = 999;
+ RestartPoint = 999;
*(volatile int *)0 = 0; //Dereferencing address 0 will hard fault the processor
}
--- a/base/firmware/web-firmware-query.c Fri May 03 14:41:57 2019 +0000
+++ b/base/firmware/web-firmware-query.c Wed May 08 12:14:13 2019 +0000
@@ -11,6 +11,6 @@
pQuery = HttpQuerySplit(pQuery, &pName, &pValue);
int value = HttpQueryValueAsInt(pValue);
- if (HttpSameStr(pName, "restart")) Restart();
+ if (HttpSameStr(pName, "restart")) Restart(RESTART_CAUSE_SOFTWARE_RESET);
}
}
--- a/base/login/web-login.c Fri May 03 14:41:57 2019 +0000
+++ b/base/login/web-login.c Wed May 08 12:14:13 2019 +0000
@@ -2,7 +2,7 @@
#include "web-pages-base.h"
#include "web-login.h"
#include "http.h"
-#include "fault.h"
+#include "reset.h"
int WebLoginOriginalToDo = 0;
@@ -30,6 +30,6 @@
}
void WebLoginInit()
{
- if (FaultCauseGet()) WebLoginPasswordRestore();
+ if (!ResetWasPushButton()) WebLoginPasswordRestore();
WebLoginSessionNameCreate();
}
\ No newline at end of file
--- a/web-add.c Fri May 03 14:41:57 2019 +0000
+++ b/web-add.c Wed May 08 12:14:13 2019 +0000
@@ -127,6 +127,13 @@
if (value) WebAddLabelledText(label, "On");
else WebAddLabelledText(label, "Off");
}
+void WebAddLabelledLed(char* label, bool value)
+{
+ HttpAddText("<div class='line'>\r\n");
+ HttpAddF (" <div>%s</div>\r\n", label);
+ HttpAddF (" <div class='led' dir='%s'></div>\r\n", value ? "rtl" : "ltr");
+ HttpAddText("</div>\r\n");
+}
void WebAddLabelledInt(char* label, int value)
{
char text[30];
--- a/web-add.h Fri May 03 14:41:57 2019 +0000 +++ b/web-add.h Wed May 08 12:14:13 2019 +0000 @@ -14,6 +14,7 @@ extern void WebAddLabelledIp4 (char* label, uint32_t ip); extern void WebAddLabelledIp6 (char* label, char* ip); extern void WebAddLabelledOnOff (char* label, bool value); +extern void WebAddLabelledLed (char* label, bool value); extern void WebAddLabelledInt (char* label, int value); extern void WebAddInputText (char* label, float inputwidth, char* value, char* action, char* name);