Monitor motorhome leisure battery and provide simple control of habitation
Dependencies: net lpc1768 crypto clock web fram log
web-this/battery/web-battery-ajax.c@9:d957af50fdc2, 2022-06-06 (annotated)
- Committer:
- andrewboyson
- Date:
- Mon Jun 06 11:08:53 2022 +0000
- Revision:
- 9:d957af50fdc2
- Parent:
- web-this/boiler/web-boiler-ajax.c@0:b843d647695c
Added battery message for can bus
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 0:b843d647695c | 1 | #include <stdint.h> |
andrewboyson | 0:b843d647695c | 2 | #include <stdio.h> |
andrewboyson | 0:b843d647695c | 3 | |
andrewboyson | 0:b843d647695c | 4 | #include "http.h" |
andrewboyson | 9:d957af50fdc2 | 5 | #include "comms.h" |
andrewboyson | 0:b843d647695c | 6 | |
andrewboyson | 9:d957af50fdc2 | 7 | void WebBatteryAjax() |
andrewboyson | 0:b843d647695c | 8 | { |
andrewboyson | 0:b843d647695c | 9 | HttpOk("text/plain; charset=UTF-8", "no-cache", NULL, NULL); |
andrewboyson | 9:d957af50fdc2 | 10 | |
andrewboyson | 9:d957af50fdc2 | 11 | HttpAddInt32AsHex(BatteryGetCountedCapacity()); |
andrewboyson | 9:d957af50fdc2 | 12 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 13 | |
andrewboyson | 9:d957af50fdc2 | 14 | HttpAddByteAsHex(BatteryGetCountedError()); |
andrewboyson | 9:d957af50fdc2 | 15 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 16 | |
andrewboyson | 9:d957af50fdc2 | 17 | HttpAddInt32AsHex(BatteryGetCurrentMa()); |
andrewboyson | 9:d957af50fdc2 | 18 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 19 | |
andrewboyson | 9:d957af50fdc2 | 20 | HttpAddByteAsHex(BatteryGetCapacitySetPointPercent()); |
andrewboyson | 9:d957af50fdc2 | 21 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 22 | |
andrewboyson | 9:d957af50fdc2 | 23 | HttpAddChar(BatteryGetOutputState()); |
andrewboyson | 9:d957af50fdc2 | 24 | HttpAddChar('\n'); |
andrewboyson | 0:b843d647695c | 25 | |
andrewboyson | 0:b843d647695c | 26 | int nibble = 0; |
andrewboyson | 9:d957af50fdc2 | 27 | if (BatteryGetChargeEnabled() ) nibble |= 1; |
andrewboyson | 9:d957af50fdc2 | 28 | if (BatteryGetDischargeEnabled()) nibble |= 2; |
andrewboyson | 9:d957af50fdc2 | 29 | HttpAddNibbleAsHex (nibble); |
andrewboyson | 9:d957af50fdc2 | 30 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 31 | |
andrewboyson | 9:d957af50fdc2 | 32 | HttpAddInt16AsHex(BatteryGetTemperatureTenths()); |
andrewboyson | 9:d957af50fdc2 | 33 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 34 | |
andrewboyson | 9:d957af50fdc2 | 35 | HttpAddInt16AsHex(BatteryGetTemperatureSetPoint()); |
andrewboyson | 9:d957af50fdc2 | 36 | HttpAddChar('\n'); |
andrewboyson | 0:b843d647695c | 37 | |
andrewboyson | 9:d957af50fdc2 | 38 | HttpAddByteAsHex(BatteryGetHeaterOutputPercent()); |
andrewboyson | 9:d957af50fdc2 | 39 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 40 | |
andrewboyson | 9:d957af50fdc2 | 41 | HttpAddInt16AsHex(BatteryGetVoltageMv()); |
andrewboyson | 9:d957af50fdc2 | 42 | HttpAddChar('\n'); |
andrewboyson | 0:b843d647695c | 43 | |
andrewboyson | 9:d957af50fdc2 | 44 | HttpAddByteAsHex(BatteryGetMeasuredPercent()); |
andrewboyson | 9:d957af50fdc2 | 45 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 46 | |
andrewboyson | 9:d957af50fdc2 | 47 | HttpAddByteAsHex(BatteryGetMeasuredError()); |
andrewboyson | 9:d957af50fdc2 | 48 | HttpAddChar('\n'); |
andrewboyson | 9:d957af50fdc2 | 49 | |
andrewboyson | 9:d957af50fdc2 | 50 | HttpAddByteAsHex(BatteryGetCapacityAutoUpdate()); |
andrewboyson | 9:d957af50fdc2 | 51 | HttpAddChar('\n'); |
andrewboyson | 0:b843d647695c | 52 | } |
andrewboyson | 0:b843d647695c | 53 |