A GPS disciplined clock
Dependencies: net lpc1768 crypto clock web log
Diff: web-this/home/web-home-ajax.c
- Revision:
- 87:5052e316994a
- Parent:
- 60:7cab896b0fd4
--- a/web-this/home/web-home-ajax.c Wed Feb 19 13:55:35 2020 +0000 +++ b/web-this/home/web-home-ajax.c Thu Feb 20 15:25:34 2020 +0000 @@ -17,18 +17,34 @@ clktime now = ClkNowTai(); clktime fraction = now & ((1UL << CLK_TIME_ONE_SECOND_SHIFT) - 1); clktime ms = (fraction * 1000) >> CLK_TIME_ONE_SECOND_SHIFT; - HttpAddInt16AsHex(ms ); HttpAddChar('\n'); - char byte = 0; - if (RtcIsSet() ) byte |= 0x01; - if (ClkTimeIsSet() ) byte |= 0x02; - if (PpsIsStable() ) byte |= 0x04; - if (NmeaTimeIsStable() ) byte |= 0x08; - if (ClkGovRateIsSynced ) byte |= 0x10; - if (ClkGovTimeIsSynced ) byte |= 0x20; - if (ClkUtcGetNextLeapEnable() ) byte |= 0x40; - if (ClkUtcGetNextLeapForward()) byte |= 0x80; - HttpAddByteAsHex (byte ); HttpAddChar('\n'); - HttpAddInt12AsHex(ClkUtcGetNextEpochMonth1970()); HttpAddChar('\n'); - HttpAddInt16AsHex(ClkUtcGetEpochOffset() ); HttpAddChar('\n'); + HttpAddInt16AsHex(ms); + HttpAddChar('\n'); + + char nibble; + nibble = 0; + if (!NmeaSerialMessagesStopped) nibble |= 0x08; //bit 12 + if (!NmeaFixMessagesStopped ) nibble |= 0x04; //bit 11 + if (!NmeaTimeMessagesStopped ) nibble |= 0x02; //bit 10 + if (PpsIsStable() ) nibble |= 0x01; //bit 9 + HttpAddNibbleAsHex(nibble); + + nibble = 0; + if (NmeaTimeIsStable() ) nibble |= 0x08; //bit 8 + if (RtcIsSet() ) nibble |= 0x04; //bit 7 + if (ClkTimeIsSet() ) nibble |= 0x02; //bit 6 + if (ClkGovIsReceivingTime ) nibble |= 0x01; //bit 5 + HttpAddNibbleAsHex(nibble); + + nibble = 0; + if (ClkGovRateIsSynced ) nibble |= 0x08; //bit 4 + if (ClkGovTimeIsSynced ) nibble |= 0x04; //bit 3 + HttpAddNibbleAsHex(nibble); + HttpAddChar('\n'); + + HttpAddInt12AsHex(ClkUtcGetNextEpochMonth1970()); + HttpAddChar('\n'); + + HttpAddInt16AsHex(ClkUtcGetEpochOffset()); + HttpAddChar('\n'); }