Skip to content

Commit

Permalink
templates, I2C/1Wire reset tune, bins
Browse files Browse the repository at this point in the history
  • Loading branch information
anklimov committed Nov 17, 2023
1 parent 5235bb6 commit 18fbc78
Show file tree
Hide file tree
Showing 20 changed files with 53,293 additions and 53,078 deletions.
Binary file modified compiled/Mega2560-optiboot/firmware.bin
Binary file not shown.
15,337 changes: 7,697 additions & 7,640 deletions compiled/Mega2560-optiboot/firmware.hex

Large diffs are not rendered by default.

19,731 changes: 9,887 additions & 9,844 deletions compiled/controllino/firmware.hex

Large diffs are not rendered by default.

Binary file modified compiled/due/firmware.bin
Binary file not shown.
Binary file modified compiled/esp32-wifi/firmware.bin
Binary file not shown.
Binary file modified compiled/esp8266-wifi/firmware.bin
Binary file not shown.
Binary file modified compiled/lighthub21/firmware.bin
Binary file not shown.
Binary file modified compiled/m5stack/firmware.bin
Binary file not shown.
21,068 changes: 10,555 additions & 10,513 deletions compiled/mega2560-5100/firmware.hex

Large diffs are not rendered by default.

18,525 changes: 9,278 additions & 9,247 deletions compiled/mega2560-5500/firmware.hex

Large diffs are not rendered by default.

Binary file modified compiled/mega2560slim/firmware.bin
Binary file not shown.
14,174 changes: 7,110 additions & 7,064 deletions compiled/mega2560slim/firmware.hex

Large diffs are not rendered by default.

13,167 changes: 6,598 additions & 6,569 deletions compiled/nrf52840/firmware.hex

Large diffs are not rendered by default.

Binary file modified compiled/stm32-enc2860/firmware.bin
Binary file not shown.
Binary file modified compiled/stm32/firmware.bin
Binary file not shown.
Binary file modified compiled/stm32/firmware.elf
Binary file not shown.
4,319 changes: 2,137 additions & 2,182 deletions compiled/stm32/firmware.map

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions lighthub/owTerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ int owSetup() {
if (oneWire) return true; // Already initialized
#ifdef DS2482_100_I2C_TO_1W_BRIDGE

debugSerial<<F("DS2482_100_I2C_TO_1W_BRIDGE init")<<endl;
debugSerial<<F("Free:")<<freeRam()<<endl;
debugSerial<<F("1WT: DS2482_100_I2C_TO_1W_BRIDGE init")<<endl;
//debugSerial<<F("Free:")<<freeRam()<<endl;
oneWire = new OneWire;
#else
debugSerial.print(F("One wire setup on PIN:"));
Expand All @@ -146,19 +146,19 @@ if (!oneWire)
#ifdef DS2482_100_I2C_TO_1W_BRIDGE
Wire.begin();
if (oneWire->checkPresence()) {
infoSerial.println(F("1WT: DS2482-100 present"));
infoSerial.println(F("1WT: DS2482-100 present, reset"));
oneWire->deviceReset();
#ifdef APU_OFF
debugSerial.println(F("APU off"));
#else
oneWire->setActivePullup();
#endif

debugSerial.println(F("\tChecking for 1-Wire devices..."));
// debugSerial.println(F("\tChecking for 1-Wire devices..."));
if (oneWire->wireReset())
debugSerial.println(F("\tReset done"));
debugSerial.println(F("1WT: Bus Reset done"));
else
debugSerial.println(F("\tDS2482 reset error"));
debugSerial.println(F("1WT: Bus reset error"));
//return true;
}
else
Expand Down Expand Up @@ -229,22 +229,22 @@ int sensors_loop(void) {
i2cReset();
break;

case DS2482_ERROR_TIMEOUT:
errorSerial<<F("1WT: timeout")<<endl;
oneWire->wireReset();
return INTERVAL_1W;
case DS2482_ERROR_TIMEOUT: //Busy over time
errorSerial<<F("1WT: BUSY timeout")<<endl;
i2cReset();
break;

default:
errorSerial<<F("1WT: error")<<endl;
oneWire->wireReset();
return INTERVAL_1W;
break;
}
/*
if (!oneWire->checkPresence())
{
infoSerial.println(F("1WT: lost DS2482-100"));
i2cReset();
}

*/

#endif

Expand Down
6 changes: 5 additions & 1 deletion lighthub/templateStr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define _TEMPLATE_STREAM_H_

#include <Stream.h>
#include <aJSON.h>
#include <streamlog.h>
//#define KEYLEN 8
extern aJsonObject * topics;

Expand Down Expand Up @@ -30,6 +32,7 @@ class templateStream : public Stream
{
str[pos+2+i]='\0';
val=resolveKey(str+pos+2);
valpos=0;
str[pos+2+i]='}';
pos+=3+i;
}
Expand Down Expand Up @@ -83,8 +86,9 @@ class templateStream : public Stream
if (valObj->type == aJson_String) return valObj->valuestring;

}
if (suffix && (suffix<=suffixNum) && !strcmp(key,"sfx"))
if (suffix && (suffix<suffixNum) && !strcmp(key,"sfx"))
{
//debugSerial<<F("Template: Suffix=")<<suffix<<endl;
buffer[0]='/';
strncpy_P(buffer+1,suffix_P[suffix],sizeof(buffer)-2);
return buffer;
Expand Down
16 changes: 12 additions & 4 deletions lighthub/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,11 @@ switch (cmdType)
// dict = aJson.createObject();
// aJson.addStringToObject(dict, "sfx", )
suffix=_itemCmd.getSuffix();
if (!suffix)
{
if (_itemCmd.isCommand()) suffix=S_CMD;
else if (_itemCmd.isValue()) suffix = S_SET;
}
}

//debugSerial << F("IN:") << (pin) << F(" : ") <<endl;
Expand All @@ -720,7 +725,7 @@ switch (cmdType)
char addrstr[MQTT_TOPIC_LENGTH];
//ts.setTimeout(0);
addrstr[ts.readBytesUntil('\0',addrstr,sizeof(addrstr))]='\0';
debugSerial << F("Emit: ")<<emit->valuestring<<" "<<addrstr<< F(" -> ")<<emitCommand<<endl;
debugSerial << F("Emit: <")<<emit->valuestring<<"> "<<addrstr<< F(" -> ")<<emitCommand<<endl;
/*
TODO implement
#ifdef WITH_DOMOTICZ
Expand Down Expand Up @@ -895,7 +900,7 @@ bool checkToken(char * token, char * data)


bool i2cReset(){
debugSerial.println("I2C Reset");
debugSerial.println(F("I2C Reset"));

Wire.endTransmission(true);
#if !defined(ARDUINO_ARCH_ESP8266)
Expand All @@ -911,19 +916,22 @@ pinMode(SDA,INPUT);
pulse=!pulse;
delay(10);//10us мкс
}

delay(20);
Wire.begin();

#ifdef DS2482_100_I2C_TO_1W_BRIDGE
if (oneWire && oneWire->checkPresence())
{
oneWire->deviceReset();
debugSerial.println(F("1WT: DS2482 present, reset"));
#ifndef APU_OFF
oneWire->setActivePullup();
#endif
if (oneWire->wireReset())
debugSerial.println(F("\tReset done"));
debugSerial.println(F("1WT: Bus Reset done"));
else
debugSerial.println(F("\tDS2482 reset error"));
debugSerial.println(F("1WT: Bus reset error"));
}
#endif

Expand Down

0 comments on commit 18fbc78

Please sign in to comment.