mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-23 05:46:09 +02:00
0.8.120
* improved and fixed factory image generation * fix HMT-1800-4T number of inputs #1628
This commit is contained in:
parent
b51ba5639b
commit
8c7bb9358e
4 changed files with 42 additions and 32 deletions
|
@ -10,7 +10,7 @@ First install on the requested platform the standard firmware and configure ever
|
||||||
|
|
||||||
First create a directory `data` inside the following project path: `src/`.
|
First create a directory `data` inside the following project path: `src/`.
|
||||||
|
|
||||||
As the export removes all your password you need to add them again to the `json` file. Open the `json` file with a text editor and search for all the `"pwd": ""`. Between the second bunch of quotation marks you have to place the password.
|
As the export removes all your passwords you need to add them again to the `json` file. Open the `json` file with a text editor and search for all the `"pwd":""` sections. Between the second bunch of quotation marks you have to place the password.
|
||||||
|
|
||||||
*Note: It's recommended to keep all information in one line to save space on the ESP littlefs partition*
|
*Note: It's recommended to keep all information in one line to save space on the ESP littlefs partition*
|
||||||
|
|
||||||
|
@ -26,35 +26,21 @@ ahoy
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
## modify platform.ini to build factory binary
|
|
||||||
|
|
||||||
Open the file `src/platformio.ini` and uncomment the following line `#post:../scripts/add_littlefs_binary.py` (remove the `#`)
|
|
||||||
|
|
||||||
## build firmware
|
## build firmware
|
||||||
|
|
||||||
Choose your prefered environment and build firmware as usual. Once the process is finished you should find along with the standard `firmware.bin` an additional file called `firmware.factory.bin`. Both files are located here: `src/.pio/build/[ENVIRONMENT]/`
|
Choose your prefered environment and build firmware as usual. Once the process is finished you should find along with the standard `firmware.bin` an additional file called `firmware.factory.bin`. Both files are located here: `src/.pio/build/[ENVIRONMENT]/`
|
||||||
|
|
||||||
## Upload to device
|
## Upload to device
|
||||||
|
|
||||||
Navigate to the firmware output directory `src/.pio/build/[ENVIRONMENT]/` and open a terminal.
|
Navigate to the firmware output directory `src/.pio/build/[ENVIRONMENT]/` and open a terminal or vice versa.
|
||||||
|
|
||||||
### ESP32
|
|
||||||
|
|
||||||
Python:
|
Python:
|
||||||
`esptool.py -b 921600 write_flash --flash_mode dio --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.factory.bin`
|
`esptool.py -b 921600 write_flash --flash_mode dio --flash_size detect 0x0 firmware.factory.bin`
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
`esptool.exe -b 921600 write_flash --flash_mode dio --flash_size detect 0x1000 bootloader.bin 0x8000 partitions.bin 0x10000 firmware.factory.bin`
|
`esptool.exe -b 921600 write_flash --flash_mode dio --flash_size detect 0x0 firmware.factory.bin`
|
||||||
|
|
||||||
### ESP32-S3 (OpenDTU Fusion Board)
|
The upload should be finished within one minute.
|
||||||
|
|
||||||
Python:
|
|
||||||
`esptool.py -b 921600 write_flash --flash_mode dio --flash_size detect 0x10000 firmware.factory.bin`
|
|
||||||
|
|
||||||
Windows:
|
|
||||||
`esptool.exe -b 921600 write_flash --flash_mode dio --flash_size detect 0x10000 firmware.factory.bin`
|
|
||||||
|
|
||||||
For a 4MB flash size the upload should be finished within 22 seconds.
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
@ -62,10 +48,9 @@ Reboot your ESP an check if all your settings are present.
|
||||||
|
|
||||||
## Keep updated with 'Mainline'
|
## Keep updated with 'Mainline'
|
||||||
|
|
||||||
From time to time a new version of AhoyDTU will be published. To get this changes into your alread prepared factory binary generation environment you have to do only a few steps:
|
From time to time a new version of AhoyDTU will be published. To get the changes into your already prepared factory binary generation environment you have to do only a few steps:
|
||||||
|
|
||||||
1. revert the changes of `platformio.ini` by executing from repository root: `git checkout src/platformio.ini`
|
1. pull new changes from remote: `git pull`
|
||||||
2. pull new changes from remote: `git pull`
|
2. check if the `data` folder is still there and contains the `settings.json`
|
||||||
3. modify the `platformio.ini` again as you can read above (remove comment)
|
3. build and upload
|
||||||
4. build and upload
|
4. enjoy
|
||||||
5. enjoy
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
from SCons.Script import DefaultEnvironment
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
|
||||||
def build_littlefs():
|
def build_littlefs():
|
||||||
|
if os.path.isfile('data/settings.json') == False:
|
||||||
|
return # nothing to do
|
||||||
result = subprocess.run(["pio", "run", "--target", "buildfs", "--environment", env['PIOENV']])
|
result = subprocess.run(["pio", "run", "--target", "buildfs", "--environment", env['PIOENV']])
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print("Error building LittleFS:")
|
print("Error building LittleFS:")
|
||||||
|
@ -13,6 +16,13 @@ def build_littlefs():
|
||||||
print("LittleFS build successful")
|
print("LittleFS build successful")
|
||||||
|
|
||||||
def merge_bins():
|
def merge_bins():
|
||||||
|
if os.path.isfile('data/settings.json') == False:
|
||||||
|
return # nothing to do
|
||||||
|
|
||||||
|
BOOTLOADER_OFFSET = 0x0000
|
||||||
|
PARTITIONS_OFFSET = 0x8000
|
||||||
|
FIRMWARE_OFFSET = 0x10000
|
||||||
|
|
||||||
flash_size = int(env.BoardConfig().get("upload.maximum_size", "4194304"))
|
flash_size = int(env.BoardConfig().get("upload.maximum_size", "4194304"))
|
||||||
app0_offset = 0x10000
|
app0_offset = 0x10000
|
||||||
if env['PIOENV'][:7] == "esp8266":
|
if env['PIOENV'][:7] == "esp8266":
|
||||||
|
@ -31,6 +41,12 @@ def merge_bins():
|
||||||
start = os.getcwd()
|
start = os.getcwd()
|
||||||
os.chdir('.pio/build/' + env['PIOENV'] + '/')
|
os.chdir('.pio/build/' + env['PIOENV'] + '/')
|
||||||
|
|
||||||
|
with open("bootloader.bin", "rb") as bootloader_file:
|
||||||
|
bootloader_data = bootloader_file.read()
|
||||||
|
|
||||||
|
with open("partitions.bin", "rb") as partitions_file:
|
||||||
|
partitions_data = partitions_file.read()
|
||||||
|
|
||||||
with open("firmware.bin", "rb") as firmware_file:
|
with open("firmware.bin", "rb") as firmware_file:
|
||||||
firmware_data = firmware_file.read()
|
firmware_data = firmware_file.read()
|
||||||
|
|
||||||
|
@ -38,11 +54,16 @@ def merge_bins():
|
||||||
littlefs_data = littlefs_file.read()
|
littlefs_data = littlefs_file.read()
|
||||||
|
|
||||||
with open("firmware.factory.bin", "wb") as merged_file:
|
with open("firmware.factory.bin", "wb") as merged_file:
|
||||||
# fill gap with 0xff
|
merged_file.write(b'\xFF' * BOOTLOADER_OFFSET)
|
||||||
merged_file.write(firmware_data)
|
merged_file.write(bootloader_data)
|
||||||
if len(firmware_data) < (littlefs_offset - app0_offset):
|
|
||||||
merged_file.write(b'\xFF' * ((littlefs_offset - app0_offset) - len(firmware_data)))
|
|
||||||
|
|
||||||
|
merged_file.write(b'\xFF' * (PARTITIONS_OFFSET - (BOOTLOADER_OFFSET + len(bootloader_data))))
|
||||||
|
merged_file.write(partitions_data)
|
||||||
|
|
||||||
|
merged_file.write(b'\xFF' * (FIRMWARE_OFFSET - (PARTITIONS_OFFSET + len(partitions_data))))
|
||||||
|
merged_file.write(firmware_data)
|
||||||
|
|
||||||
|
merged_file.write(b'\xFF' * (littlefs_offset - (FIRMWARE_OFFSET + len(firmware_data))))
|
||||||
merged_file.write(littlefs_data)
|
merged_file.write(littlefs_data)
|
||||||
|
|
||||||
os.chdir(start)
|
os.chdir(start)
|
||||||
|
@ -51,6 +72,5 @@ def main(target, source, env):
|
||||||
build_littlefs()
|
build_littlefs()
|
||||||
merge_bins()
|
merge_bins()
|
||||||
|
|
||||||
|
|
||||||
# ensure that script is called once firmeware was compiled
|
# ensure that script is called once firmeware was compiled
|
||||||
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", main)
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", main)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## 0.8.120 - 2024-05-18
|
## 0.8.120 - 2024-05-18
|
||||||
* fix crash if invalid serial number was set -> inverter will be disabled automatically
|
* fix crash if invalid serial number was set -> inverter will be disabled automatically
|
||||||
* improved and fixed factory image generation
|
* improved and fixed factory image generation
|
||||||
|
* fix HMT-1800-4T number of inputs #1628
|
||||||
|
|
||||||
## 0.8.119 - 2024-05-17
|
## 0.8.119 - 2024-05-17
|
||||||
* fix reset values at midnight if WiFi isn't available #1620
|
* fix reset values at midnight if WiFi isn't available #1620
|
||||||
|
|
|
@ -69,9 +69,13 @@ class HmSystem {
|
||||||
iv->ivRadioType = INV_RADIO_TYPE_NRF;
|
iv->ivRadioType = INV_RADIO_TYPE_NRF;
|
||||||
}
|
}
|
||||||
} else if(iv->config->serial.b[5] == 0x13) {
|
} else if(iv->config->serial.b[5] == 0x13) {
|
||||||
iv->ivGen = IV_HMT;
|
iv->ivGen = IV_HMT;
|
||||||
|
if(iv->config->serial.b[4] == 0x61)
|
||||||
|
iv->type = INV_TYPE_4CH;
|
||||||
|
else
|
||||||
iv->type = INV_TYPE_6CH;
|
iv->type = INV_TYPE_6CH;
|
||||||
iv->ivRadioType = INV_RADIO_TYPE_CMT;
|
|
||||||
|
iv->ivRadioType = INV_RADIO_TYPE_CMT;
|
||||||
} else if(iv->config->serial.u64 != 0ULL) {
|
} else if(iv->config->serial.u64 != 0ULL) {
|
||||||
DPRINTLN(DBG_ERROR, F("inverter type can't be detected!"));
|
DPRINTLN(DBG_ERROR, F("inverter type can't be detected!"));
|
||||||
iv->config->enabled = false;
|
iv->config->enabled = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue