finalize builder
This commit is contained in:
parent
fc04b190a4
commit
c8ff21f522
|
@ -10,6 +10,8 @@ import subprocess
|
|||
import sys
|
||||
import platform
|
||||
import re
|
||||
import configparser
|
||||
from time import sleep as delay
|
||||
|
||||
|
||||
# Get the current directory
|
||||
|
@ -54,8 +56,35 @@ else:
|
|||
# Add the environment to the list of environments
|
||||
environments.append(environment)
|
||||
|
||||
# Remove old platformio.ini file from firmware folder if it exists
|
||||
if os.path.isfile(os.path.join(firmware_folder, 'platformio.ini')):
|
||||
os.remove(os.path.join(firmware_folder, 'platformio.ini'))
|
||||
|
||||
# Copy the platformio.ini file to the firmware folder
|
||||
shutil.copyfile(os.path.join(current_dir, 'platformio.ini'), os.path.join(firmware_folder, 'platformio.ini'))
|
||||
|
||||
# Check that the file is copied correctly
|
||||
if not os.path.isfile(os.path.join(firmware_folder, 'platformio.ini')):
|
||||
raise Exception('platformio.ini file not copied correctly')
|
||||
|
||||
# Read the platformio.ini file
|
||||
config = configparser.ConfigParser()
|
||||
config.read(os.path.join(firmware_folder, 'platformio.ini'))
|
||||
|
||||
# Add firmware version to build_flags in platformio.ini
|
||||
for environment in environments:
|
||||
subprocess.run([f'{platformio_path}/platformio.exe', 'run', '-e', environment,f'-DFW_VERSION={git_branch}_{environment}_{commit_hash}'], cwd=current_dir)
|
||||
if 'build_flags' not in config[f'env:{environment}']:
|
||||
config[f'env:{environment}']['build_flags'] = f'-DFW_VERSION=\\"{git_branch}_{environment}_{commit_hash}\\"'
|
||||
else:
|
||||
config[f'env:{environment}']['build_flags'] = config[f'env:{environment}']['build_flags'] + f' -DFW_VERSION=\\"{git_branch}_{environment}_{commit_hash}\\"'
|
||||
|
||||
# if argument is not supplied, build all environments listed in platformio.ini
|
||||
if len(sys.argv) == 1:
|
||||
subprocess.run([f'{platformio_path}/platformio.exe', 'run','-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
||||
|
||||
for environment in environments:
|
||||
if(len(sys.argv) > 1):
|
||||
subprocess.run([f'{platformio_path}/platformio.exe', 'run', '-e', environment,'-c',f'{firmware_folder}/platformio.ini'], cwd=current_dir)
|
||||
|
||||
# Iterate over the subfolders in the firmware folder
|
||||
for subfolder in os.listdir(firmware_folder):
|
||||
|
|
|
@ -395,6 +395,11 @@ void ota_begin()
|
|||
otabuffer+=ota_part2_1+"IP Address"+ota_part2_2+IP.toString()+ota_part2_3;
|
||||
otabuffer+=ota_part2_1+"MAC Address"+ota_part2_2+ETH.macAddress()+ota_part2_3;
|
||||
otabuffer+=ota_part2_1+"Device"+ota_part2_2+ESPMEGA_REV+ota_part2_3;
|
||||
#ifdef FW_VERSION
|
||||
otabuffer+=ota_part2_1+"Firmware"+ota_part2_2+FW_VERSION+ota_part2_3;
|
||||
#else
|
||||
otabuffer+=ota_part2_1+"Firmware"+ota_part2_2+"Out of Tree"+ota_part2_3;
|
||||
#endif
|
||||
otabuffer+=ota_part2_1+"BMS Server"+ota_part2_2+MQTT_SERVER.toString()+ota_part2_3;
|
||||
otabuffer+=ota_part2_1+"BMS Endpoint"+ota_part2_2+String(MQTT_BASE_TOPIC)+ota_part2_3;
|
||||
otabuffer+=ota_part2_1+"Centrally Managed"+ota_part2_2;
|
||||
|
|
Loading…
Reference in New Issue