Skip to content

Commit

Permalink
Fixed issue where GPIO setup becomes invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
gskjold committed Jan 18, 2023
1 parent 4b15ac7 commit e8fc6d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/AmsToMqttBridge.ino
Original file line number Diff line number Diff line change
Expand Up @@ -121,47 +121,6 @@ DSMRParser *dsmrParser = NULL;
void setup() {
Serial.begin(115200);

if(!config.getGpioConfig(gpioConfig)) {
#if HW_ROARFRED
gpioConfig.hanPin = 3;
gpioConfig.apPin = 0;
gpioConfig.ledPin = 2;
gpioConfig.ledInverted = true;
gpioConfig.tempSensorPin = 5;
#elif defined(ARDUINO_ESP8266_WEMOS_D1MINI)
gpioConfig.hanPin = 5;
gpioConfig.apPin = 4;
gpioConfig.ledPin = 2;
gpioConfig.ledInverted = true;
gpioConfig.tempSensorPin = 14;
gpioConfig.vccMultiplier = 1100;
#elif defined(ARDUINO_LOLIN_D32)
gpioConfig.hanPin = 16;
gpioConfig.ledPin = 5;
gpioConfig.ledInverted = true;
gpioConfig.tempSensorPin = 14;
#elif defined(ARDUINO_FEATHER_ESP32)
gpioConfig.hanPin = 16;
gpioConfig.ledPin = 2;
gpioConfig.tempSensorPin = 14;
#elif defined(ARDUINO_ESP32_DEV)
gpioConfig.hanPin = 16;
gpioConfig.ledPin = 2;
gpioConfig.ledInverted = true;
#elif defined(ESP8266)
gpioConfig.hanPin = 3;
gpioConfig.ledPin = 2;
gpioConfig.ledInverted = true;
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
gpioConfig.hanPin = 18;
#elif defined(ESP32)
gpioConfig.hanPin = 16;
gpioConfig.ledPin = 2;
gpioConfig.ledInverted = true;
gpioConfig.tempSensorPin = 14;
#endif
}

delay(1);
config.loadTempSensors();
hw.setup(&gpioConfig, &config);
Expand Down
8 changes: 8 additions & 0 deletions src/web/AmsWebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,13 +1023,15 @@ void AmsWebServer::handleSetup() {

switch(sys.boardType) {
case 0: // roarfred
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 3;
gpioConfig->apPin = 0;
gpioConfig->ledPin = 2;
gpioConfig->ledInverted = true;
gpioConfig->tempSensorPin = 5;
break;
case 1: // Arnio Kamstrup
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 3;
gpioConfig->apPin = 0;
gpioConfig->ledPin = 2;
Expand All @@ -1039,6 +1041,7 @@ void AmsWebServer::handleSetup() {
gpioConfig->ledRgbInverted = true;
break;
case 2: // spenceme
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 3;
gpioConfig->apPin = 0;
gpioConfig->ledPin = 2;
Expand All @@ -1048,6 +1051,7 @@ void AmsWebServer::handleSetup() {
wifi.sleep = 1;
break;
case 3: // Pow UART0
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 3;
gpioConfig->apPin = 0;
gpioConfig->ledPin = 2;
Expand All @@ -1058,6 +1062,7 @@ void AmsWebServer::handleSetup() {
wifi.sleep = 1;
break;
case 4: // Pow GPIO12
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 12;
gpioConfig->apPin = 0;
gpioConfig->ledPin = 2;
Expand All @@ -1068,6 +1073,7 @@ void AmsWebServer::handleSetup() {
wifi.sleep = 1;
break;
case 5: // Pow-K+ UART2
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 16;
gpioConfig->apPin = 0;
gpioConfig->ledPinRed = 13;
Expand All @@ -1079,6 +1085,7 @@ void AmsWebServer::handleSetup() {
wifi.sleep = 1;
break;
case 6: // Pow-P1
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 16;
gpioConfig->apPin = 0;
gpioConfig->ledPinRed = 13;
Expand All @@ -1089,6 +1096,7 @@ void AmsWebServer::handleSetup() {
gpioConfig->vccResistorVcc = 33;
break;
case 7: // Pow-U+
config->clearGpio(*gpioConfig);
gpioConfig->hanPin = 16;
gpioConfig->apPin = 0;
gpioConfig->ledPinRed = 13;
Expand Down

0 comments on commit e8fc6d4

Please sign in to comment.