61 lines
1.9 KiB
Makefile
61 lines
1.9 KiB
Makefile
serial := "/dev/ttyACM0"
|
|
freakwan_repository := "git@github.com:antirez/freakwan.git"
|
|
freakwan_directory := "freakwan"
|
|
default_nick := "eriol"
|
|
micropython_version := "LILYGO_TTGO_LORA32-20240602-v1.23.0.bin"
|
|
|
|
# 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
|
|
mpremote cp wan_config.{{NICK}}.py :wan_config.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:
|
|
mpremote soft-reset
|
|
|
|
# Erase board memory
|
|
erase:
|
|
esptool.py --chip esp32 --port {{serial}} erase_flash
|
|
|
|
# Donwload freakwan
|
|
download-freakwan:
|
|
rm -rf {{ freakwan_directory }}
|
|
git clone {{ freakwan_repository }} {{ freakwan_directory }}
|
|
|
|
# Donwload the firmware for LILYGO TTGO LoRa32
|
|
download-firmware:
|
|
# See https://micropython.org/download/LILYGO_TTGO_LORA32/
|
|
# for details.
|
|
mkdir -p firmware
|
|
curl https://micropython.org/resources/firmware/{{ micropython_version }} --output firmware/{{ micropython_version }}
|
|
|
|
# Flash the firmare
|
|
firmware:
|
|
esptool.py --chip esp32 --port {{serial}} --baud 460800 write_flash -z 0x1000 firmware/{{ micropython_version }}
|
|
|
|
# Erase borad memory, flash the firmware and deploy freakwan
|
|
coldstart: erase firmware deploy
|