mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
Merge branch 'development' into release
This commit is contained in:
commit
0855098b01
@ -58,7 +58,7 @@ bool UdpDisconnect(void)
|
|||||||
|
|
||||||
bool UdpConnect(void)
|
bool UdpConnect(void)
|
||||||
{
|
{
|
||||||
if (!udp_connected) {
|
if (!udp_connected && !restart_flag) {
|
||||||
// Simple Service Discovery Protocol (SSDP)
|
// Simple Service Discovery Protocol (SSDP)
|
||||||
if (PortUdp.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 1900)) {
|
if (PortUdp.beginMulticast(WiFi.localIP(), IPAddress(239,255,255,250), 1900)) {
|
||||||
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED));
|
AddLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED));
|
||||||
|
@ -1935,6 +1935,7 @@ void OtherSaveSettings(void)
|
|||||||
SettingsUpdateText(SET_WEBPWD, (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? SettingsText(SET_WEBPWD) : tmp);
|
SettingsUpdateText(SET_WEBPWD, (!strlen(tmp)) ? "" : (strchr(tmp,'*')) ? SettingsText(SET_WEBPWD) : tmp);
|
||||||
Settings.flag.mqtt_enabled = WebServer->hasArg("b1"); // SetOption3 - Enable MQTT
|
Settings.flag.mqtt_enabled = WebServer->hasArg("b1"); // SetOption3 - Enable MQTT
|
||||||
#ifdef USE_EMULATION
|
#ifdef USE_EMULATION
|
||||||
|
UdpDisconnect();
|
||||||
#if defined(USE_EMULATION_WEMO) || defined(USE_EMULATION_HUE)
|
#if defined(USE_EMULATION_WEMO) || defined(USE_EMULATION_HUE)
|
||||||
WebGetArg("b2", tmp, sizeof(tmp));
|
WebGetArg("b2", tmp, sizeof(tmp));
|
||||||
Settings.flag2.emulation = (!strlen(tmp)) ? 0 : atoi(tmp);
|
Settings.flag2.emulation = (!strlen(tmp)) ? 0 : atoi(tmp);
|
||||||
|
@ -89,6 +89,10 @@ uint8_t OneWireReset(void)
|
|||||||
digitalWrite(ds18x20_pin, LOW);
|
digitalWrite(ds18x20_pin, LOW);
|
||||||
delayMicroseconds(480);
|
delayMicroseconds(480);
|
||||||
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT); // SetOption74 - Enable internal pullup for single DS18x20 sensor
|
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT); // SetOption74 - Enable internal pullup for single DS18x20 sensor
|
||||||
|
delayMicroseconds(70);
|
||||||
|
uint8_t r = !digitalRead(ds18x20_pin);
|
||||||
|
delayMicroseconds(410);
|
||||||
|
return r;
|
||||||
} else {
|
} else {
|
||||||
digitalWrite(ds18x20_pin_out, HIGH);
|
digitalWrite(ds18x20_pin_out, HIGH);
|
||||||
do {
|
do {
|
||||||
@ -100,11 +104,11 @@ uint8_t OneWireReset(void)
|
|||||||
digitalWrite(ds18x20_pin_out, LOW);
|
digitalWrite(ds18x20_pin_out, LOW);
|
||||||
delayMicroseconds(480);
|
delayMicroseconds(480);
|
||||||
digitalWrite(ds18x20_pin_out, HIGH);
|
digitalWrite(ds18x20_pin_out, HIGH);
|
||||||
|
delayMicroseconds(70);
|
||||||
|
uint8_t r = !digitalRead(ds18x20_pin);
|
||||||
|
delayMicroseconds(410);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
delayMicroseconds(70);
|
|
||||||
uint8_t r = !digitalRead(ds18x20_pin);
|
|
||||||
delayMicroseconds(410);
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneWireWriteBit(uint8_t v)
|
void OneWireWriteBit(uint8_t v)
|
||||||
@ -126,26 +130,27 @@ void OneWireWriteBit(uint8_t v)
|
|||||||
delayMicroseconds(delay_high[v]);
|
delayMicroseconds(delay_high[v]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t OneWireReadBit(void)
|
uint8_t OneWire1ReadBit(void)
|
||||||
{
|
{
|
||||||
if (!ds18x20_dual_mode) {
|
pinMode(ds18x20_pin, OUTPUT);
|
||||||
pinMode(ds18x20_pin, OUTPUT);
|
digitalWrite(ds18x20_pin, LOW);
|
||||||
digitalWrite(ds18x20_pin, LOW);
|
delayMicroseconds(3);
|
||||||
delayMicroseconds(3);
|
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT); // SetOption74 - Enable internal pullup for single DS18x20 sensor
|
||||||
pinMode(ds18x20_pin, Settings.flag3.ds18x20_internal_pullup ? INPUT_PULLUP : INPUT); // SetOption74 - Enable internal pullup for single DS18x20 sensor
|
delayMicroseconds(10);
|
||||||
delayMicroseconds(10);
|
uint8_t r = digitalRead(ds18x20_pin);
|
||||||
uint8_t r = digitalRead(ds18x20_pin);
|
delayMicroseconds(53);
|
||||||
delayMicroseconds(53);
|
return r;
|
||||||
return r;
|
}
|
||||||
} else {
|
|
||||||
digitalWrite(ds18x20_pin_out, LOW);
|
uint8_t OneWire2ReadBit(void)
|
||||||
delayMicroseconds(3);
|
{
|
||||||
digitalWrite(ds18x20_pin_out, HIGH);
|
digitalWrite(ds18x20_pin_out, LOW);
|
||||||
delayMicroseconds(10);
|
delayMicroseconds(3);
|
||||||
uint8_t r = digitalRead(ds18x20_pin);
|
digitalWrite(ds18x20_pin_out, HIGH);
|
||||||
delayMicroseconds(53);
|
delayMicroseconds(10);
|
||||||
return r;
|
uint8_t r = digitalRead(ds18x20_pin);
|
||||||
}
|
delayMicroseconds(53);
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------------------*/
|
||||||
@ -161,9 +166,17 @@ uint8_t OneWireRead(void)
|
|||||||
{
|
{
|
||||||
uint8_t r = 0;
|
uint8_t r = 0;
|
||||||
|
|
||||||
for (uint8_t bit_mask = 0x01; bit_mask; bit_mask <<= 1) {
|
if (!ds18x20_dual_mode) {
|
||||||
if (OneWireReadBit()) {
|
for (uint8_t bit_mask = 0x01; bit_mask; bit_mask <<= 1) {
|
||||||
r |= bit_mask;
|
if (OneWire1ReadBit()) {
|
||||||
|
r |= bit_mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (uint8_t bit_mask = 0x01; bit_mask; bit_mask <<= 1) {
|
||||||
|
if (OneWire2ReadBit()) {
|
||||||
|
r |= bit_mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
@ -207,9 +220,13 @@ uint8_t OneWireSearch(uint8_t *newAddr)
|
|||||||
}
|
}
|
||||||
OneWireWrite(W1_SEARCH_ROM);
|
OneWireWrite(W1_SEARCH_ROM);
|
||||||
do {
|
do {
|
||||||
id_bit = OneWireReadBit();
|
if (!ds18x20_dual_mode) {
|
||||||
cmp_id_bit = OneWireReadBit();
|
id_bit = OneWire1ReadBit();
|
||||||
|
cmp_id_bit = OneWire1ReadBit();
|
||||||
|
} else {
|
||||||
|
id_bit = OneWire2ReadBit();
|
||||||
|
cmp_id_bit = OneWire2ReadBit();
|
||||||
|
}
|
||||||
if ((id_bit == 1) && (cmp_id_bit == 1)) {
|
if ((id_bit == 1) && (cmp_id_bit == 1)) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user