orgua / OneWireHub

OneWire slave device emulator
GNU General Public License v3.0
343 stars 86 forks source link

Edit scratchpad registers in Setup() or Loop(). See reference: orgua#124 #125

Closed rtek1000 closed 1 year ago

rtek1000 commented 1 year ago

I duplicated the constructor as a function, I hope it's enough to update the scratchpad data.

https://github.com/orgua/OneWireHub/issues/124

orgua commented 1 year ago

why?

the clean way to implement your new device would be to write a new class that inherits from the ds18b20 and brings the additional functionallity of your new sensor.

I can't follow your intention. in the other thread you assumed that you need to change the scratchpad, but it sound more like the serial-id you are after.

does that help? a way to allow changing the Serial-ID during runtime

orgua commented 1 year ago

btw: your PR does nothing. the ID1:7 arguments are not used and the same values (already set in constructor) are written to the scratchpad?!

rtek1000 commented 1 year ago

btw: your PR does nothing. the ID1:7 arguments are not used and the same values (already set in constructor) are written to the scratchpad?!

Yes, I confused the ID (the 48-BIT SERIAL NUMBER, contained in the 64-Bit Lasered ROM Code) with the scratchpad as described in https://github.com/orgua/OneWireHub/issues/124

I'll try to follow instructions from https://github.com/orgua/OneWireHub/discussions/119