mirror of https://github.com/arendst/Tasmota.git
Merge pull request #6795 from bkmit/development
Add Setoption74 to runtime configuration of internal pullup resistor usage for single DS18x20 sensor
This commit is contained in:
commit
5ebe2b92bb
|
@ -87,7 +87,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
|
|||
uint32_t dds2382_model : 1; // bit 21 (v6.6.0.14) - SetOption71 - Select different Modbus registers for Active Energy (#6531)
|
||||
uint32_t hardware_energy_total : 1; // bit 22 (v6.6.0.15) - SetOption72 - Enable / Disable hardware energy total counter as reference (#6561)
|
||||
uint32_t cors_enabled : 1; // bit 23 (v7.0.0.1) - SetOption73 - Enable HTTP CORS
|
||||
uint32_t spare24 : 1;
|
||||
uint32_t ds18x20_internal_pullup : 1; // bit 24 (v7.0.0.1) - SetOption74 - Enable internal pullup for single DS18x20 sensor
|
||||
uint32_t spare25 : 1;
|
||||
uint32_t spare26 : 1;
|
||||
uint32_t spare27 : 1;
|
||||
|
|
|
@ -74,11 +74,7 @@ uint8_t OneWireReset(void)
|
|||
uint8_t retries = 125;
|
||||
|
||||
//noInterrupts();
|
||||
#ifdef DS18B20_INTERNAL_PULLUP
|
||||
pinMode(ds18x20_pin, INPUT_PULLUP);
|
||||
#else
|
||||
pinMode(ds18x20_pin, INPUT);
|
||||
#endif
|
||||
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT);
|
||||
do {
|
||||
if (--retries == 0) {
|
||||
return 0;
|
||||
|
@ -88,11 +84,7 @@ uint8_t OneWireReset(void)
|
|||
pinMode(ds18x20_pin, OUTPUT);
|
||||
digitalWrite(ds18x20_pin, LOW);
|
||||
delayMicroseconds(480);
|
||||
#ifdef DS18B20_INTERNAL_PULLUP
|
||||
pinMode(ds18x20_pin, INPUT_PULLUP);
|
||||
#else
|
||||
pinMode(ds18x20_pin, INPUT);
|
||||
#endif
|
||||
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT);
|
||||
delayMicroseconds(70);
|
||||
uint8_t r = !digitalRead(ds18x20_pin);
|
||||
//interrupts();
|
||||
|
@ -121,11 +113,7 @@ uint8_t OneWireReadBit(void)
|
|||
pinMode(ds18x20_pin, OUTPUT);
|
||||
digitalWrite(ds18x20_pin, LOW);
|
||||
delayMicroseconds(3);
|
||||
#ifdef DS18B20_INTERNAL_PULLUP
|
||||
pinMode(ds18x20_pin, INPUT_PULLUP);
|
||||
#else
|
||||
pinMode(ds18x20_pin, INPUT);
|
||||
#endif
|
||||
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT);
|
||||
delayMicroseconds(10);
|
||||
uint8_t r = digitalRead(ds18x20_pin);
|
||||
//interrupts();
|
||||
|
|
Loading…
Reference in New Issue