Files
ESP8266_UPS/Makefile
2024-02-23 07:57:03 +00:00

41 lines
1.5 KiB
Makefile

datasdir := $(HOME)/.make/
pio := $(HOME)/.platformio/penv/bin/pio
ttydown := /dev/ttyUSB0
#webdev := http://192.168.2.200/
#webdev := http://ESP8266-UPS_2E3ED3.lan/
webdev := http://ESP8266-UPS.lan/
all : $(datasdir) $(datasdir)PlatformIO/esp8266 .pio/libdeps
$(pio) run
.pio/libdeps :
cp -rf lib/ .pio/
update : $(datasdir) $(datasdir)PlatformIO/esp8266 .pio/libdeps
$(pio) run
curl $(webdev)rebootload || echo 你干嘛
sleep 2
curl -#lF 'firmware=@./.pio/build/esp12e/firmware.bin' $(webdev)update | tee /dev/null
install : $(datasdir) $(datasdir)PlatformIO/esp8266 .pio/libdeps
$(pio) run --target upload --upload-port $(ttydown)
clean : $(datasdir) $(datasdir)PlatformIO/esp8266
$(pio) run --target clean
$(datasdir) :
mkdir $(datasdir)
$(datasdir)udev :
echo OK >$(datasdir)udev
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules -o 99-platformio-udev.rules
sudo mv 99-platformio-udev.rules /etc/udev/rules.d/99-platformio-udev.rules
sudo service udev restart
sudo service udev restart
echo OK >$(datasdir)udev
$(datasdir)PlatformIO.info : $(datasdir)
sudo print
curl -#fL https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py -o get-platformio.py
sudo apt install -y python3.8-venv
python3 get-platformio.py
mkdir $(datasdir)PlatformIO
echo OK >$(datasdir)PlatformIO.info
$(datasdir)PlatformIO/esp8266 : $(datasdir)udev $(datasdir)PlatformIO.info
$(pio) platform install espressif8266
echo OK >$(datasdir)PlatformIO/esp8266