diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..cb00daca --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Report a bug +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Hardware information:** + - Meter: [e.g. Aidon] + - AMS reader: [e.g. Pow-U, ESP32 etc] + - M-bus adapter (if applicable): + +**Relevant firmware information:** + - Version: [e.g. 1.5.0] + - MQTT: [yes/no] + - HAN GPIO: [e.g. GPIO5] + - Temperature sensors [e.g. 3xDS18B20] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/support.md b/.github/ISSUE_TEMPLATE/support.md new file mode 100644 index 00000000..981cfa37 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support.md @@ -0,0 +1,22 @@ +--- +name: Support +about: Request support +title: '' +labels: '' +assignees: '' + +--- + +**Describe your problem** +A clear and concise description of what the problem is. + +**Hardware information:** + - Meter: [e.g. Aidon] + - AMS reader: [e.g. Pow-U, ESP32 etc] + - M-bus adapter (if applicable): + +**Relevant firmware information:** + - Version: [e.g. 1.5.0] + - MQTT: [yes/no] + - HAN GPIO: [e.g. GPIO5] + - Temperature sensors [e.g. 3xDS18B20] diff --git a/src/AmsToMqttBridge.ino b/src/AmsToMqttBridge.ino index 51bb38d5..3d028869 100644 --- a/src/AmsToMqttBridge.ino +++ b/src/AmsToMqttBridge.ino @@ -62,6 +62,7 @@ MQTTClient mqtt(512); AmsMqttHandler* mqttHandler = NULL; Stream *hanSerial; +SoftwareSerial *swSerial = NULL; GpioConfig gpioConfig; MeterConfig meterConfig; @@ -136,8 +137,11 @@ void setup() { bool shared = false; config.getMeterConfig(meterConfig); + Serial.flush(); + Serial.end(); if(gpioConfig.hanPin == 3) { shared = true; +<<<<<<< HEAD #if defined(ESP8266) SerialConfig serialConfig; #elif defined(ESP32) @@ -166,6 +170,9 @@ void setup() { if(!shared) { Serial.begin(115200); +======= + setupHanPort(gpioConfig.hanPin, meterConfig.type); +>>>>>>> master } DebugConfig debug; @@ -477,9 +484,11 @@ void setupHanPort(uint8_t pin, uint32_t baud, uint8_t parityOrdinal, bool invert if(Debug.isActive(RemoteDebug::INFO)) Debug.printf("(setupHanPort) Setting up HAN on pin %d with baud %d and parity %d\n", pin, baud, parityOrdinal); HardwareSerial *hwSerial = NULL; - if(pin == 3) { + if(pin == 3 || pin == 113) { hwSerial = &Serial; } + + #if defined(ESP32) if(pin == 9) { hwSerial = &Serial1; @@ -496,6 +505,7 @@ void setupHanPort(uint8_t pin, uint32_t baud, uint8_t parityOrdinal, bool invert if(hwSerial != NULL) { debugD("Hardware serial"); +<<<<<<< HEAD Serial.flush(); #if defined(ESP8266) SerialConfig serialConfig; @@ -511,21 +521,52 @@ void setupHanPort(uint8_t pin, uint32_t baud, uint8_t parityOrdinal, bool invert break; case 10: serialConfig = SERIAL_7E1; +======= + hwSerial->flush(); + hwSerial->end(); + + switch(newMeterType) { + case METER_TYPE_KAMSTRUP: + case METER_TYPE_OMNIPOWER: + hwSerial->begin(2400, SERIAL_8N1); +>>>>>>> master break; default: serialConfig = SERIAL_8E1; break; } +<<<<<<< HEAD #if defined(ESP32) hwSerial->begin(baud, serialConfig, -1, -1, invert); #else hwSerial->begin(baud, serialConfig, SERIAL_FULL, 1, invert); #endif +======= + #if defined(ESP8266) + if(pin == 3) { + debugI("Switching UART0 to pin 1 & 3"); + Serial.pins(1,3); + } else if(pin == 113) { + debugI("Switching UART0 to pin 15 & 13"); + Serial.pins(15,13); + } + #endif + +>>>>>>> master hanSerial = hwSerial; } else { debugD("Software serial"); Serial.flush(); +<<<<<<< HEAD +======= + + if(swSerial != NULL) { + swSerial->end(); + delete swSerial; + } + swSerial = new SoftwareSerial(pin); +>>>>>>> master SoftwareSerialConfig serialConfig; switch(parityOrdinal) { @@ -547,6 +588,7 @@ void setupHanPort(uint8_t pin, uint32_t baud, uint8_t parityOrdinal, bool invert swSerial->begin(baud, serialConfig); hanSerial = swSerial; + Serial.end(); Serial.begin(115200); } diff --git a/src/web/AmsWebServer.cpp b/src/web/AmsWebServer.cpp index 6d03a73c..467368c8 100644 --- a/src/web/AmsWebServer.cpp +++ b/src/web/AmsWebServer.cpp @@ -205,7 +205,7 @@ void AmsWebServer::temperaturePost() { delay(1); } - if (debugger->isActive(RemoteDebug::DEBUG)) config->print(debugger); + //if (debugger->isActive(RemoteDebug::DEBUG)) config->print(debugger); if(config->save()) { printD("Successfully saved temperature sensors"); server.sendHeader("Location", String("/temperature"), true); @@ -1198,7 +1198,7 @@ void AmsWebServer::handleSave() { printI("Saving configuration now..."); - if (debugger->isActive(RemoteDebug::DEBUG)) config->print(debugger); + //if (debugger->isActive(RemoteDebug::DEBUG)) config->print(debugger); if (config->save()) { printI("Successfully saved."); if(config->isWifiChanged()) { @@ -1344,6 +1344,11 @@ String AmsWebServer::getSerialSelectOptions(int selected) { #elif defined(ESP8266) int numGpio = 9; int gpios[] = {4,5,9,10,12,13,14,15,16}; + if(selected == 113) { + gpioOptions += ""; + } else { + gpioOptions += ""; + } #endif for(int i = 0; i < numGpio; i++) {