Change statuses to ints

This commit is contained in:
Tanner Collin 2021-03-10 18:44:32 -07:00
parent fa6809b507
commit a632034751

View File

@ -12,7 +12,13 @@ output_folder = Path('./output')
app = Flask(__name__, static_folder=str(build_folder), static_url_path='') app = Flask(__name__, static_folder=str(build_folder), static_url_path='')
CORS(app) CORS(app)
status = 'Standby' STANDBY = 0
WARMUP = 1
CAPTURING = 2
WRITING = 3
DOWNLOADING = 4
status = STANDBY
@app.route('/api/status', methods=['GET']) @app.route('/api/status', methods=['GET'])
def status_get(): def status_get():
@ -97,7 +103,7 @@ def session_post(cid):
abort(404) abort(404)
# go through the photo taking process # go through the photo taking process
status = 'Warming up' status = WARMUP
try: try:
# warmup # warmup
@ -112,7 +118,7 @@ def session_post(cid):
print() print()
abort(500) abort(500)
status = 'Capturing' status = CAPTURING
# capture # capture
power.lights_on() power.lights_on()
@ -126,13 +132,13 @@ def session_post(cid):
power.grid_off() power.grid_off()
power.lights_off() power.lights_off()
status = 'Writing to files' status = WRITING
time.sleep(3) time.sleep(3)
status = 'Downloading' status = DOWNLOADING
download.download_all_photos(path) download.download_all_photos(path)
status = 'Standby' status = STANDBY
return '' return ''
@app.route('/') @app.route('/')