Open KSUMotorsport opened 1 year ago
import subprocess
def is_main_or_master_dirty():
try:
# Run 'git rev-parse --abbrev-ref HEAD' to get the current branch name
current_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).decode('utf-8').strip()
# Check if the current branch is either "main" or "master"
is_main_or_master = current_branch in ['main', 'master']
# Run 'git status --porcelain' to check for uncommitted changes
is_dirty = subprocess.call(['git', 'status', '--porcelain']) != 0
return is_main_or_master, is_dirty
except Exception as e:
print(f"Error: {e}")
return False, False
is_main_or_master, is_dirty = is_main_or_master_dirty()
print(f"Is main or master: {is_main_or_master}")
print(f"Is dirty: {is_dirty}")
chatgpt script, integrating this with https://github.com/KSU-MS/pio-git-hash-gen would let you tell at compile time:
Could include a single parameter for each board which would sent out a CAN packet indicating if any code currently running on the car is untested. Whenever code has been tested and verified to not break the car, the CAN packet would be enabled, broadcasting a "code is MAIN" message. Would just be a unique ID for each board, with all of the boards on CAN 1 being sent to VCU to get repeated onto CAN 2. The dash would then turn a light OFF if any message is being received, indicating that the code is current. This would also allow us to see which board has untested code on it, and save time instead of having to reupload code onto every single board each time the car goes out.
The OK message must be received to turn the light off, which keeps false "OK" messages being interpreted (i.e. the code being tested kills the CANBUS and thus no message would get to the dash)