fix for software 1-wire driver

This commit is contained in:
2020-05-09 04:03:21 +03:00
parent d4536e403c
commit 6277a44b1d
4 changed files with 46 additions and 14 deletions

View File

@@ -72,7 +72,9 @@ int owUpdate() {
debugSerial.println();
if (term[t_count][0] == 0x28) {
sensors->setResolution(term[t_count], TEMPERATURE_PRECISION);
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
oneWire->setStrongPullup();
#endif
// sensors.requestTemperaturesByAddress(term[t_count]);
}
t_count++;
@@ -127,7 +129,7 @@ int owSetup(owChangedType owCh) {
return false;
#else
// software driver
oneWire->deviceReset();
oneWire->reset();
delay(500);
return true;
#endif //DS2482-100
@@ -138,13 +140,14 @@ return false;
int sensors_loop(void) {
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (oneWire->getError() == DS2482_ERROR_SHORT)
{
debugSerial<<F("1-wire shorted")<<endl;
oneWire->wireReset();
return 10000;
}
#endif
if (!sensors)
{
@@ -202,9 +205,18 @@ void owAdd(DeviceAddress addr) {
debugSerial<<F("dev#")<<t_count<<F(" Addr:");
PrintBytes(term[t_count], 8,0);
debugSerial.println();
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (term[t_count][0] == 0x28)
oneWire->setStrongPullup();
#endif
t_count++;
#endif
}
#endif
void setupOwIdle (void (*ptr)())
{
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (oneWire) oneWire->idle(ptr);
#endif
}