From 2e4e67730b27471b997138f4f6038cd1bc43920c Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 30 Aug 2020 15:08:06 +0200 Subject: [PATCH 1/2] tidy up how to upload on ESP32 - #471 --- README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index dd3f3d436..07f805e82 100644 --- a/README.md +++ b/README.md @@ -51,17 +51,24 @@ Note there are some noticeable different to be aware of in version 2: ## **Uploading the firmware** -- If you're not using PlatformIO, use the command-line and Python. You can download Python from https://www.python.org/downloads/. Make sure you also get: - - `esptool`, install using the command `pip install esptool` - - and for OTA updates later, `espota` from https://github.com/esp8266/Arduino/blob/master/tools/espota.py using `python espota.py --debug --progress --port 8266 --auth ems-esp-neo -i ems-esp.local -f ` +### *Using PlatformIO*: +- create a new file called `pio_local.ini` and add +```yaml +upload_protocol = esptool +upload_port = +``` +replacing with the port for example on Windows `COM4`, or Linux/OSX `/dev/cu.wchusbserial1410` +- execute the command `pio run -t upload` -- Grab the latest firmware binary from https://github.com/proddy/EMS-ESP/releases/tag/travis-v2-build -- Uploading directly via USB. - - For ESP8266: `esptool.py -p -b 921600 write_flash 0x00000 ` - note: if this fails try a lower speed like `115200` instead of `921600`. - - For ESP32: `esptool.py --chip esp32 --port "COM6" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 XX\.platformio\packages\framework-arduinoespressif32\tools\sdk\bin\bootloader_dio_40m.bin 0x8000 XX\.pio\build\esp32\partitions.bin 0xe000 XX\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin 0x10000 ` +### *Not using PlatformIO*: + +Here we'll use the command-line. You'll need: + +- `esptool`, install [Python]( https://www.python.org/downloads/) and then do `pip install esptool`. If `pip` doesn't work, use `pip3`. +- `espota` from https://github.com/esp8266/Arduino/blob/master/tools/espota.py + +- The latest firmware binary from https://github.com/proddy/EMS-ESP/releases +- Uploading directly via USB with the ESP8266: `esptool.py -p -b 921600 write_flash 0x00000 ` - Uploading over WiFi: `espota.py --debug --progress --port 8266 --auth ems-esp-neo -i -f ` ## **Setting EMS-ESP up for the first time** @@ -72,7 +79,7 @@ Note there are some noticeable different to be aware of in version 2: - First thing to check is if Tx is working and that you have a connect to the EMS bus. If it's showing an error try changing the Tx Mode from the settings page. Then check the Status (no need to restart EMS-ESP). - - If Rx incomplete telegrams are reported in the Web UI, don't panic. Some telegrams can be missed and this is usually due to noise on line. + - If Rx incomplete telegrams are reported in the Web UI, don't panic. Some telegrams can be missed and this is usually caused by noise interference on the line. ## **Using the Console** From a711c37a4252739aee266c60397d8b9846914986 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 30 Aug 2020 15:21:21 +0200 Subject: [PATCH 2/2] set master takes mandatory deviceID - #469 --- src/devices/thermostat.cpp | 17 ++++++----------- src/locale_EN.h | 1 - 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index c5783afd2..ece522832 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -928,15 +928,15 @@ void Thermostat::process_RC10Set(std::shared_ptr telegram) { // type 0x0165, ff void Thermostat::process_JunkersSet(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); - telegram->read_value(hc->daytemp, 17); // is * 2 - telegram->read_value(hc->nighttemp, 16); // is * 2 + telegram->read_value(hc->daytemp, 17); // is * 2 + telegram->read_value(hc->nighttemp, 16); // is * 2 telegram->read_value(hc->nofrosttemp, 15); // is * 2 } // type 0x0179, ff void Thermostat::process_JunkersSet2(std::shared_ptr telegram) { std::shared_ptr hc = heating_circuit(telegram); - telegram->read_value(hc->daytemp, 7); // is * 2 - telegram->read_value(hc->nighttemp, 6); // is * 2 + telegram->read_value(hc->daytemp, 7); // is * 2 + telegram->read_value(hc->nighttemp, 6); // is * 2 telegram->read_value(hc->nofrosttemp, 5); // is * 2 } @@ -1143,14 +1143,9 @@ void Thermostat::console_commands(Shell & shell, unsigned int context) { EMSESPShell::commands->add_command(ShellContext::THERMOSTAT, CommandFlags::ADMIN, flash_string_vector{F_(set), F_(master)}, - flash_string_vector{F_(deviceid_optional)}, + flash_string_vector{F_(deviceid_mandatory)}, [](Shell & shell, const std::vector & arguments) { - uint8_t value; - if (arguments.empty()) { - value = EMSESP_DEFAULT_MASTER_THERMOSTAT; - } else { - value = Helpers::hextoint(arguments.front().c_str()); - } + uint8_t value = Helpers::hextoint(arguments.front().c_str()); EMSESP::emsespSettingsService.update( [&](EMSESPSettings & settings) { diff --git a/src/locale_EN.h b/src/locale_EN.h index 57f74f86c..548c21d76 100644 --- a/src/locale_EN.h +++ b/src/locale_EN.h @@ -108,7 +108,6 @@ MAKE_PSTR(gpio_mandatory, "") MAKE_PSTR(data_optional, "[data]") MAKE_PSTR(typeid_mandatory, "") MAKE_PSTR(deviceid_mandatory, "") -MAKE_PSTR(deviceid_optional, "[device ID]") MAKE_PSTR(invalid_log_level, "Invalid log level") MAKE_PSTR(log_level_fmt, "Log level = %s") MAKE_PSTR(log_level_optional, "[level]")