Manages the 1-wire bus
Dependents: oldheating heating
web/web-1wire-query.c@10:b4e0b4c4e045, 2020-06-10 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed Jun 10 17:02:21 2020 +0000
- Revision:
- 10:b4e0b4c4e045
- Parent:
- 2:79cad6a51fd0
Modified the web module to allow up to 8 devices rather than 4.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 1:c272b1fcc834 | 1 | #include <string.h> |
andrewboyson | 1:c272b1fcc834 | 2 | #include <stdlib.h> |
andrewboyson | 1:c272b1fcc834 | 3 | #include "http.h" |
andrewboyson | 1:c272b1fcc834 | 4 | #include "1-wire-device.h" |
andrewboyson | 1:c272b1fcc834 | 5 | #include "settings.h" |
andrewboyson | 1:c272b1fcc834 | 6 | #include "ds18b20.h" |
andrewboyson | 1:c272b1fcc834 | 7 | |
andrewboyson | 2:79cad6a51fd0 | 8 | void WebOneWireQuery(char* pQuery) |
andrewboyson | 1:c272b1fcc834 | 9 | { |
andrewboyson | 1:c272b1fcc834 | 10 | while (pQuery) |
andrewboyson | 1:c272b1fcc834 | 11 | { |
andrewboyson | 1:c272b1fcc834 | 12 | char* pName; |
andrewboyson | 1:c272b1fcc834 | 13 | char* pValue; |
andrewboyson | 1:c272b1fcc834 | 14 | pQuery = HttpQuerySplit(pQuery, &pName, &pValue); |
andrewboyson | 1:c272b1fcc834 | 15 | |
andrewboyson | 1:c272b1fcc834 | 16 | HttpQueryUnencode(pValue); |
andrewboyson | 1:c272b1fcc834 | 17 | |
andrewboyson | 1:c272b1fcc834 | 18 | int value = HttpQueryValueAsInt(pValue); |
andrewboyson | 1:c272b1fcc834 | 19 | |
andrewboyson | 1:c272b1fcc834 | 20 | if (HttpSameStr(pName, "rom0")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[0](rom); } |
andrewboyson | 1:c272b1fcc834 | 21 | if (HttpSameStr(pName, "rom1")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[1](rom); } |
andrewboyson | 1:c272b1fcc834 | 22 | if (HttpSameStr(pName, "rom2")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[2](rom); } |
andrewboyson | 1:c272b1fcc834 | 23 | if (HttpSameStr(pName, "rom3")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[3](rom); } |
andrewboyson | 10:b4e0b4c4e045 | 24 | if (HttpSameStr(pName, "rom4")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[4](rom); } |
andrewboyson | 10:b4e0b4c4e045 | 25 | if (HttpSameStr(pName, "rom5")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[5](rom); } |
andrewboyson | 10:b4e0b4c4e045 | 26 | if (HttpSameStr(pName, "rom6")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[6](rom); } |
andrewboyson | 10:b4e0b4c4e045 | 27 | if (HttpSameStr(pName, "rom7")) { char rom[8]; DeviceParseAddress(pValue, rom); DS18B20RomSetters[7](rom); } |
andrewboyson | 1:c272b1fcc834 | 28 | |
andrewboyson | 1:c272b1fcc834 | 29 | if (HttpSameStr(pName, "onewiretrace" )) ChgTraceOneWire(); |
andrewboyson | 1:c272b1fcc834 | 30 | } |
andrewboyson | 1:c272b1fcc834 | 31 | } |