1
0
Fork 0
freakwan-setup/justfile

59 lines
1.8 KiB
Makefile

serial := "/dev/ttyACM0"
freakwan_repository := "git@github.com:eriol/freakwan.git"
default_nick := "eriol"
# Connetct to the ESP32 device using serial
shell:
talk32 {{serial}} repl
rshell:
rshell -p {{serial}}
# Deploy freakwan
deploy-talk32:
cp freakwan/devices/device_config.t3_v2_1_6.py freakwan/device_config.py
talk32 {{serial}} put freakwan/*.py
# Deploy freakwan
deploy:
cp freakwan/devices/device_config.t3_v2_1_6.py freakwan/device_config.py
mpremote cp freakwan/*.py :
# Deploy a custom freakwan's config with the specified nickname
deploy-conf NICK=default_nick: && reset
cp freakwan/wan_config.py wan_config.{{NICK}}.py
sed -i "s/\(\s\)\(#\) \(config\['nick'\]=\"\)mynickname\(\"\)/\1\3{{NICK}}\"/" wan_config.{{NICK}}.py
talk32 {{serial}} --destname wan_config.py put wan_config.{{NICK}}.py
rm wan_config.{{NICK}}.py
# Set the nick in the freakwan config to NICK
# set-nick NICK:
# @sed -i "s/\(\s\)\(#\) \(config\['nick'\]=\"\)mynickname\(\"\)/\1\3{{NICK}}\"/" freakwan/wan_config.py
# Reset the board
reset:
talk32 {{serial}} reset
# Erase board memory
erase:
esptool.py --chip esp32 --port {{serial}} erase_flash
# Donwload freakwan
download-freakwan:
git clone {{freakwan_repository}}
# Donwload the firmware for LILYGO TTGO LoRa32
download-firmware:
# See https://micropython.org/download/LILYGO_TTGO_LORA32/
# for details.
mkdir firmware
curl https://www.micropython.org/resources/firmware/LILYGO_TTGO_LORA32-20240222-v1.22.2.bin --output firmware/LILYGO_TTGO_LORA32-20240222-v1.22.2.bin
# Flash the firmare
firmware:
esptool.py --chip esp32 --port {{serial}} --baud 460800 write_flash -z 0x1000 firmware/LILYGO_TTGO_LORA32-20220618-v1.19.1.bin
# Erase borad memory, flash the firmware and deploy freakwan
coldstart: erase firmware deploy