Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Revision:
15:2cea2bbd5046
Parent:
14:c3c43c8faf0e
Child:
19:598dd2145e84
--- a/http-clock-html.c	Sat Dec 29 19:01:39 2018 +0000
+++ b/http-clock-html.c	Mon Dec 31 18:49:36 2018 +0000
@@ -17,23 +17,20 @@
     PageAddH1(NavSite, "Clock");
     
     PageAddH2("Sync status");
-    if (!  RtcIsSet()) HttpAddText("<div>RTC   is not set!</div>\r\n");
-    if (!ClockIsSet()) HttpAddText("<div>Clock is not set!</div>\r\n");
-    PageAddAjaxToggle(10.0, "PPS is stable", "ajax-pps-stable", "");
-    PageAddAjaxToggle(10.0, "Rate synchronised", "ajax-rate-locked", "");
-    PageAddAjaxToggle(10.0, "Time synchronised", "ajax-time-locked", "");
+    PageAddAjaxToggle(10.0, "RTC is set"           , "ajax-rtc-set"    , "");
+    PageAddAjaxToggle(10.0, "Clock is set"         , "ajax-clock-set"  , "");
+    PageAddAjaxToggle(10.0, "External source is ok", "ajax-source-ok"  , "");
+    PageAddAjaxToggle(10.0, "Rate synchronised"    , "ajax-rate-locked", "");
+    PageAddAjaxToggle(10.0, "Time synchronised"    , "ajax-time-locked", "");
+
+    PageAddH2("Server UTC time");
+    HttpAddText("<div id='date-utc'></div>\r\n");
 
     PageAddH2("Server local time");
     HttpAddText("<div id='date-pc'></div>\r\n");
-
-    PageAddH2("Server UTC time");
-    HttpAddText("<div id='date-utc'></div>\r\n");
     
     PageAddH2("Server - PC");
     HttpAddText("<div id='date-diff'></div>\r\n");    
-    PageAddH2("Ajax");
-    HttpAddText("<code id='ajax-headers'></code>\r\n");
-    HttpAddText("<code id='ajax-response'></code>\r\n");
     
     PageAddH2("Leap seconds");
     PageAddAjaxToggle(10.0, "Next leap enable"   , "ajax-leap-enable"  , "chg-clock-leap-enable"  );
@@ -43,23 +40,28 @@
     PageAddAjaxHex   ( 6.0, "Count"       , 5.2  , "ajax-leap-count"   , "set-clock-leap-count"   );
 
     HttpAddText("<button type='button' onclick='DisplayLeap()'>Display Leap</button>\r\n");
-    
-    PageAddH2("Time");
-    struct tm tm;
-    ClockTmUtc(&tm);
-    HttpAddText("<div>\r\n");
-    PageAddTm(&tm);
-    HttpAddText("</div>\r\n");
-    ClockTmLocal(&tm);
-    HttpAddText("<div>\r\n");
-    PageAddTm(&tm);
-    HttpAddText("</div>\r\n");
-    PageAddLabelledInt("Freq ppb", 17, ClockPpb);
         
+    PageAddH2("Settings");
+    PageAddIntInput ("/clock", 0, "Ppb",                     12, "ppb",            5, ClockPpb                        );
+    PageAddIntInput ("/clock", 0, "Ppb divisor",             12, "ppbdivisor",     5, ClockPpbDivisor                 );
+    PageAddIntInput ("/clock", 0, "Ppb max change",          12, "ppbmaxchange",   5, ClockPpbChangeMax               );
+    PageAddIntInput ("/clock", 0, "Ppb synced limit",        12, "syncedlimitppb", 5, ClockSyncedLimitPpb             );
+    PageAddIntInput ("/clock", 0, "Ppb synced hysteresis",   12, "syncedhysppb",   5, ClockSyncedHysterisPpb          );
+
+    PageAddIntInput ("/clock", 0, "Offset divisor",          12, "slewdivisor",    5, ClockSlewDivisor                );
+    PageAddIntInput ("/clock", 0, "Offset max (ms)",         12, "slewmax",        5, ClockSlewMaxMs                  );
+    PageAddIntInput ("/clock", 0, "Offset synced limit (ms)",12, "syncedlimitns",  5, ClockSyncedLimitNs    / 1000000 );
+    PageAddIntInput ("/clock", 0, "Offset synced hys (ms)",  12, "syncedhysns",    5, ClockSyncedHysterisNs / 1000000 );
+    PageAddIntInput ("/clock", 0, "Offset reset limit (s)",  12, "maxoffsetsecs",  5, ClockMaxOffsetSecs              );
+
     PageAddH2("Scan times");
     PageAddLabelledInt("Program cycles avg", 17, ScanAverage);
     PageAddLabelledInt("Program cycles max", 17, ScanMaximum);
     PageAddLabelledInt("Program cycles min", 17, ScanMinimum);
 
+    PageAddH2("Ajax");
+    HttpAddText("<code id='ajax-headers'></code>\r\n");
+    HttpAddText("<code id='ajax-response'></code>\r\n");
+
     PageAddEnd();
 }