davidkreidler / OpenCO2_Sensor

Arduino Repository for an E-Ink CO2 Sensor using ESP32 and SCD4X
https://www.tindie.com/products/davidkreidler/open-co2-sensor/
MIT License
97 stars 5 forks source link

update scripts for firmware 3.3 and 4.3 on POSIX OSes #15

Open ThomasWaldmann opened 4 months ago

ThomasWaldmann commented 4 months ago

I finally updated my devices to the current firmware and had to make scripts for macOS due to the different executable name, usb-serial port name, UNIX style line endings, different needs for argument quoting, etc.

Guess if one changes the port name (which one has to check anyway), they would also work on Linux, BSD, etc.

I successfully tested them on a MacBook Pro with Apple Silicon here, but guess they also work on Intel. The scripts are based on the original update*.bat for Windows.

I also added some docs at the top of the scripts.

I had some v2.x devices, first upgraded to v3.3 (not sure if necessary), then upgraded to v4.3 using these scripts and a USB-C cable.

To upgrade to v4.4, I then used the OTA web-based firmware upload method via WiFi.

update_fw_3.3_wifi_macos.sh

## Updating the OpenCO2 sensor to firmware release 3.3 (with wifi) on macOS.
# 0. download all the .bin files of the 3.3 release from github releases page and put them into current directory.
# 1. brew install esptool    (or somehow else have a working esptool.py)
# 2. OpenCO2 sensor: press and hold the button close to the usb port, then shortly press the reset button on the other side.
# 3. execute this script.
esptool.py --chip esp32s2 --port /dev/tty.usbmodem01 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 OpenCO2_Sensor.ino.bootloader.bin 0x8000 OpenCO2_Sensor.ino.partitions.bin 0xe000 boot_app0.bin 0x10000 wifi.bin

update_fw_4.3_wifi_macos.sh

## Updating the OpenCO2 sensor to firmware release 4.3 (with wifi) on macOS.
# 0. download all the .bin files of the 4.3 release from github releases page and put them into current directory.
# 1. brew install esptool    (or somehow else have a working esptool.py)
# 2. OpenCO2 sensor: press and hold the button close to the usb port, then shortly press the reset button on the other side.
# 3. execute this script.
esptool.py --chip esp32s2 --port /dev/tty.usbmodem01 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 OpenCO2_Sensor.ino.bootloader.bin 0x8000 OpenCO2_Sensor.ino.partitions.bin 0xe000 boot_app0.bin 0x10000 OpenCO2_Sensor.ino.bin
davidkreidler commented 4 months ago

Thank you very much for sharing the details on how to update under macOS using esptool. This process was not scalable at none tech enthusiastic costumers. For all (new) devices running V4.4+ when they get connected via USB to a computer they emulate an USB flash drive to enable copy pasting of FIRMWARE.BIN