Manages the 1-wire bus
Dependents: oldheating heating
web/web-1wire-class.js@11:3859fee99d5d, 2021-02-18 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Feb 18 16:47:12 2021 +0000
- Revision:
- 11:3859fee99d5d
- Parent:
- 9:6f663ad53c7e
Added 'value not set' to the list of possible values.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 1:c272b1fcc834 | 1 | //OneWire script |
andrewboyson | 1:c272b1fcc834 | 2 | 'use strict'; |
andrewboyson | 1:c272b1fcc834 | 3 | |
andrewboyson | 1:c272b1fcc834 | 4 | class OneWire |
andrewboyson | 1:c272b1fcc834 | 5 | { |
andrewboyson | 9:6f663ad53c7e | 6 | static DS18B20ToString(value) |
andrewboyson | 1:c272b1fcc834 | 7 | { |
andrewboyson | 9:6f663ad53c7e | 8 | switch (value) |
andrewboyson | 1:c272b1fcc834 | 9 | { |
andrewboyson | 9:6f663ad53c7e | 10 | case 0x7FFF: return 'CRC error' ; |
andrewboyson | 9:6f663ad53c7e | 11 | case 0x7FFE: return 'ROM not found' ; |
andrewboyson | 9:6f663ad53c7e | 12 | case 0x7FFD: return 'Timed out' ; |
andrewboyson | 9:6f663ad53c7e | 13 | case 0x7FFC: return 'No device detected after reset'; |
andrewboyson | 9:6f663ad53c7e | 14 | case 0x7FFB: return 'Device removed during search' ; |
andrewboyson | 11:3859fee99d5d | 15 | case 0x7FFA: return 'Value not set' ; |
andrewboyson | 1:c272b1fcc834 | 16 | } |
andrewboyson | 9:6f663ad53c7e | 17 | return (value / 16.0).toFixed(1); |
andrewboyson | 1:c272b1fcc834 | 18 | } |
andrewboyson | 1:c272b1fcc834 | 19 | } |