WLED/pio-scripts/name-firmware.py
Rolf 746a8badac
Animated Staircase Usermod (#1763)
* Initial version of the PIR Staircase wipe up/down.

* Add pulldown reminder

* Workaround for missing D6 and D7 definitions on esp32dev

* Add pinouts for d1 mini (esp8266 and esp32) and NodeMCU (and Arduino)

* These IO pins on all these boards... NodeMCU and d1_mini esp32 supported. The others? Fingers crossed.

* Changed to not collide with led strip pins

* PIR on GPIO 15 and 16 on esp32 d1 mini

* Removed PIN number ifdefs, it is impossible to match all boards

* Settings in flash, info and API

* Update README.md

* Small doc changes

* Improved README

* Fixed error in reading configuration

* Add API documentation

* Documentation and code cleanup

* Add enable/disable to API settings

* Restore segment state when disabling plugin

* Add debounce

* Set segments in animation mode

* Set segments in animation mode

* Add support for HR04 sensors

* Add preliminary description for  using an HR04 sensor

* Fixed typenumber and linked to datasheet

* Moved config away from defines to prevent user error

* Trigger Sensors through API

* Rename scripts folder so that it's name doesn't clash with the `pio` command (prevents platformIO in VSCode to work properly on Mac)

* Bugfix for detection problems

* Separated config from code

* Renamed Signal to Trigger pin

* Filename adjusted

* Clarifications and additions to README

* Fixed references to pio scripts

* Fixed API trigger bug

* Adjustments to README.md

* More efficient use of flash cycles, better naming

* Bugfix: bottom sensor was not read properly

* Renamed to Animated_Staircase

* Add note on ultrasonic sensor and esp32

* Better naming of defines

* Bugfix: Swipe down started with two steps.

* Removed upload port in nodemcuv2 section

Co-authored-by: Rolf <rolf@phobos.local>
Co-authored-by: Rolf <>
2021-02-25 09:52:48 +01:00

35 lines
1.1 KiB
Python

Import('env')
import os
import shutil
OUTPUT_DIR = "build_output{}".format(os.path.sep)
def bin_rename_copy(source, target, env):
variant = str(target[0]).split(os.path.sep)[2]
# check if output directories exist and create if necessary
if not os.path.isdir(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
for d in ['firmware', 'map']:
if not os.path.isdir("{}{}".format(OUTPUT_DIR, d)):
os.mkdir("{}{}".format(OUTPUT_DIR, d))
# create string with location and file names based on variant
map_file = "{}map{}{}.map".format(OUTPUT_DIR, os.path.sep, variant)
bin_file = "{}firmware{}{}.bin".format(OUTPUT_DIR, os.path.sep, variant)
# check if new target files exist and remove if necessary
for f in [map_file, bin_file]:
if os.path.isfile(f):
os.remove(f)
# copy firmware.bin to firmware/<variant>.bin
shutil.copy(str(target[0]), bin_file)
# copy firmware.map to map/<variant>.map
if os.path.isfile("firmware.map"):
shutil.move("firmware.map", map_file)
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [bin_rename_copy])