TKK_E32232028/updater2.py

41 lines
1.2 KiB
Python

with open('esp32_serial_backend/esp32_serial_backend.ino', 'r', encoding='utf8') as f:
content = f.read()
content = content.replace(
''' gKeepTryingCmd = "RECOG";
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gCameraActive = true;''',
''' gKeepTryingCmd = "RECOG";
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gNextCaptureTime = 0;
gCameraActive = true;''')
content = content.replace(
''' gKeepTryingCmd = String("ENROLL ") + name;
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gCameraActive = true;''',
''' gKeepTryingCmd = String("ENROLL ") + name;
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gNextCaptureTime = 0;
gCameraActive = true;''')
content = content.replace(
''' gKeepTryingCmd = "RECOG";
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gCameraActive = true;''',
''' gKeepTryingCmd = "RECOG";
gKeepTryingUntil = millis() + 15000;
gLastActionSuccess = false;
gNextCaptureTime = 0;
gCameraActive = true;''')
with open('esp32_serial_backend/esp32_serial_backend.ino', 'w', encoding='utf8') as f:
f.write(content)
print("Update complete")