Andrew Boyson / web

Dependents:   oldheating gps motorhome heating

Committer:
andrewboyson
Date:
Mon Apr 29 14:45:30 2019 +0000
Revision:
109:3e82f62c7e1f
Parent:
103:91194cc19bbb
Tidied names from http to web

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 103:91194cc19bbb 1 #include <time.h>
andrewboyson 103:91194cc19bbb 2
andrewboyson 103:91194cc19bbb 3 #include "http.h"
andrewboyson 109:3e82f62c7e1f 4 #include "web-page-base.h"
andrewboyson 109:3e82f62c7e1f 5 #include "web-add.h"
andrewboyson 103:91194cc19bbb 6
andrewboyson 103:91194cc19bbb 7 void WebClockHtml()
andrewboyson 103:91194cc19bbb 8 {
andrewboyson 103:91194cc19bbb 9 HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL);
andrewboyson 109:3e82f62c7e1f 10 WebAddHeader("Clock", "settings.css", "clock.js");
andrewboyson 109:3e82f62c7e1f 11 WebAddNav(CLOCK_PAGE);
andrewboyson 109:3e82f62c7e1f 12 WebAddH1("Clock");
andrewboyson 103:91194cc19bbb 13
andrewboyson 109:3e82f62c7e1f 14 WebAddH2("Status");
andrewboyson 109:3e82f62c7e1f 15 WebAddAjaxLed("RTC is set" , "ajax-rtc-set" );
andrewboyson 109:3e82f62c7e1f 16 WebAddAjaxLed("Clock is set" , "ajax-clock-set" );
andrewboyson 109:3e82f62c7e1f 17 WebAddAjaxLed("External source is ok", "ajax-source-ok" );
andrewboyson 109:3e82f62c7e1f 18 WebAddAjaxLed("Time synchronised" , "ajax-time-locked");
andrewboyson 109:3e82f62c7e1f 19 WebAddAjaxLed("Rate synchronised" , "ajax-rate-locked");
andrewboyson 103:91194cc19bbb 20
andrewboyson 109:3e82f62c7e1f 21 WebAddH2("Server UTC time");
andrewboyson 103:91194cc19bbb 22 HttpAddText("<div id='ajax-date-utc'></div>\r\n");
andrewboyson 103:91194cc19bbb 23
andrewboyson 109:3e82f62c7e1f 24 WebAddH2("Server local time");
andrewboyson 103:91194cc19bbb 25 HttpAddText("<div id='ajax-date-pc'></div>\r\n");
andrewboyson 103:91194cc19bbb 26
andrewboyson 109:3e82f62c7e1f 27 WebAddH2("Server - PC (ms)");
andrewboyson 103:91194cc19bbb 28 HttpAddText("<div id='ajax-date-diff'></div>\r\n");
andrewboyson 103:91194cc19bbb 29
andrewboyson 109:3e82f62c7e1f 30 WebAddH2("UTC");
andrewboyson 109:3e82f62c7e1f 31 WebAddAjaxInputToggle("Enable epoch change" , "ajax-leap-enable" , "chg-clock-leap-enable" );
andrewboyson 109:3e82f62c7e1f 32 WebAddAjaxInputToggle("Direction of next epoch" , "ajax-leap-forward" , "chg-clock-leap-forward");
andrewboyson 109:3e82f62c7e1f 33 WebAddAjaxInput ("Year next epoch starts" , 4, "ajax-leap-year" , "set-clock-leap-year" );
andrewboyson 109:3e82f62c7e1f 34 WebAddAjaxInput ("Month next epoch starts" , 4, "ajax-leap-month" , "set-clock-leap-month" );
andrewboyson 109:3e82f62c7e1f 35 WebAddAjaxInput ("Current era offset" , 4, "ajax-leap-count" , "set-clock-leap-count" );
andrewboyson 103:91194cc19bbb 36
andrewboyson 103:91194cc19bbb 37 HttpAddText("<div><button type='button' onclick='displayLeap()'>Display leap</button></div>\r\n");
andrewboyson 103:91194cc19bbb 38
andrewboyson 103:91194cc19bbb 39 HttpAddText("<div>The leap seconds list is available <a href='https://www.ietf.org/timezones/data/leap-seconds.list' target='_blank'>here</a></div>\r\n");
andrewboyson 103:91194cc19bbb 40
andrewboyson 109:3e82f62c7e1f 41 WebAddH2("Governer");
andrewboyson 109:3e82f62c7e1f 42 WebAddAjaxInput ("Ppb" , 5, "ajax-ppb" , "ppb" );
andrewboyson 109:3e82f62c7e1f 43 WebAddAjaxInput ("Ppb divisor" , 5, "ajax-ppb-divisor" , "ppbdivisor" );
andrewboyson 109:3e82f62c7e1f 44 WebAddAjaxInput ("Ppb max change" , 5, "ajax-ppb-max-chg" , "ppbmaxchange" );
andrewboyson 109:3e82f62c7e1f 45 WebAddAjaxInput ("Ppb synced limit" , 5, "ajax-ppb-syn-lim" , "syncedlimitppb");
andrewboyson 109:3e82f62c7e1f 46 WebAddAjaxInput ("Ppb synced hysteresis" , 5, "ajax-ppb-syn-hys" , "syncedhysppb" );
andrewboyson 109:3e82f62c7e1f 47 WebAddAjaxInput ("Offset divisor" , 5, "ajax-off-divisor" , "slewdivisor" );
andrewboyson 109:3e82f62c7e1f 48 WebAddAjaxInput ("Offset max (ms)" , 5, "ajax-off-max" , "slewmax" );
andrewboyson 109:3e82f62c7e1f 49 WebAddAjaxInput ("Offset synced limit (ms)", 5, "ajax-off-syn-lim" , "syncedlimitns" );
andrewboyson 109:3e82f62c7e1f 50 WebAddAjaxInput ("Offset synced hys (ms)" , 5, "ajax-off-syn-hys" , "syncedhysns" );
andrewboyson 109:3e82f62c7e1f 51 WebAddAjaxInput ("Offset reset limit (s)" , 5, "ajax-off-rst-lim" , "maxoffsetsecs" );
andrewboyson 109:3e82f62c7e1f 52 WebAddAjaxInputToggle("Trace" , "ajax-gov-trace" , "clockgovtrace" );
andrewboyson 103:91194cc19bbb 53
andrewboyson 109:3e82f62c7e1f 54 WebAddH2("NTP");
andrewboyson 109:3e82f62c7e1f 55 WebAddAjaxInput ("Server url" , 5, "ajax-ntp-server" , "ntpserver" );
andrewboyson 109:3e82f62c7e1f 56 WebAddAjaxInput ("Initial interval (s)" , 5, "ajax-ntp-initial" , "clockinitial" );
andrewboyson 109:3e82f62c7e1f 57 WebAddAjaxInput ("Normal interval (m)" , 5, "ajax-ntp-normal" , "clocknormal" );
andrewboyson 109:3e82f62c7e1f 58 WebAddAjaxInput ("Retry interval (s)" , 5, "ajax-ntp-retry" , "clockretry" );
andrewboyson 109:3e82f62c7e1f 59 WebAddAjaxInput ("Offset (ms)" , 5, "ajax-ntp-offset" , "clockoffset" );
andrewboyson 109:3e82f62c7e1f 60 WebAddAjaxInput ("Max delay (ms)" , 5, "ajax-ntp-max-delay", "clockmaxdelay" );
andrewboyson 103:91194cc19bbb 61
andrewboyson 109:3e82f62c7e1f 62 WebAddH2("Scan times");
andrewboyson 109:3e82f62c7e1f 63 WebAddAjaxLabelled ("Program cycles avg", "ajax-scan-avg");
andrewboyson 109:3e82f62c7e1f 64 WebAddAjaxLabelled ("Program cycles max", "ajax-scan-max");
andrewboyson 109:3e82f62c7e1f 65 WebAddAjaxLabelled ("Program cycles min", "ajax-scan-min");
andrewboyson 103:91194cc19bbb 66
andrewboyson 109:3e82f62c7e1f 67 WebAddEnd();
andrewboyson 103:91194cc19bbb 68 }