@echo off
setlocal
call :setESC

set "comport=COM4"
set /P comport="%ESC%[94mCOM PORT[COM4]: %ESC%[0m"

echo %ESC%[94mPress any key to start update...%ESC%[0m
pause > nul

echo %ESC%[94mflashing code "ticker.ino.bin" to %comport%%ESC%[0m
esp8266\tools\python3\3.7.2-post1\python3.exe esp8266\hardware\esp8266\2.7.4/tools/upload.py --chip esp8266 --port %comport% --baud 115200 erase_flash --before default_reset --after hard_reset write_flash 0x0 ticker.ino.bin

echo %ESC%[94mflashing html/css/js/settings "ticker.mklittlefs.bin" to %comport%%ESC%[0m
esp8266\tools\python3\3.7.2-post1\python3.exe esp8266\hardware\esp8266\2.7.4/tools/upload.py --chip esp8266 --port %comport% --baud 115200 --before default_reset --after hard_reset write_flash 0x200000 ticker.mklittlefs.bin

echo %ESC%[32mDone! Press any key to exit....%ESC%[0m
pause > nul


:setESC
for /F %%a in ('"prompt $E$S & echo on & for %%b in (1) do rem"') do set "ESC=%%a"
exit /B