Manages the 1-wire bus

Dependents:   oldheating heating

Committer:
andrewboyson
Date:
Wed Jun 10 11:41:03 2020 +0000
Revision:
9:6f663ad53c7e
Parent:
8:ceafef18cbf7
Child:
11:3859fee99d5d
Changed javascript OneWire class so that DS18B20 values are read as signed 16bit numbers then printed eg OneWire.DS18B20ToString(Ajax.hexToSignedInt16(value))

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 1:c272b1fcc834 1 "//OneWire script\n"
andrewboyson 1:c272b1fcc834 2 "'use strict';\n"
andrewboyson 1:c272b1fcc834 3 "\n"
andrewboyson 1:c272b1fcc834 4 "class OneWire\n"
andrewboyson 1:c272b1fcc834 5 "{\n"
andrewboyson 9:6f663ad53c7e 6 " static DS18B20ToString(value)\n"
andrewboyson 1:c272b1fcc834 7 " {\n"
andrewboyson 9:6f663ad53c7e 8 " switch (value)\n"
andrewboyson 1:c272b1fcc834 9 " {\n"
andrewboyson 9:6f663ad53c7e 10 " case 0x7FFF: return 'CRC error' ;\n"
andrewboyson 9:6f663ad53c7e 11 " case 0x7FFE: return 'ROM not found' ;\n"
andrewboyson 9:6f663ad53c7e 12 " case 0x7FFD: return 'Timed out' ;\n"
andrewboyson 9:6f663ad53c7e 13 " case 0x7FFC: return 'No device detected after reset';\n"
andrewboyson 9:6f663ad53c7e 14 " case 0x7FFB: return 'Device removed during search' ;\n"
andrewboyson 1:c272b1fcc834 15 " }\n"
andrewboyson 9:6f663ad53c7e 16 " return (value / 16.0).toFixed(1);\n"
andrewboyson 1:c272b1fcc834 17 " }\n"
andrewboyson 1:c272b1fcc834 18 "}"