WaiveCar / WaiveScreen

WaiveScreen related stuff.
0 stars 0 forks source link

Driving upgrade #273

Closed nthobe closed 4 years ago

nthobe commented 4 years ago

I propose we add a new command handler, driving_upgrade.

Implementation would be: When a screen receives this command, it would add a key to the kv table { 'driving_upgrade': 'v0.3-Chukwa-504-gf5526ba5' } denoting the currently running version and that we want to upgrade.

On every boot, we would check for a driving_upgrade key and if the version in the value doesn't match the currently installed version, we delete the key. Otherwise we go into a loop, monitoring the speed, until we're going fast enough to attempt the upgrade.

Future versions of this could be given a specific version to upgrade to. It would also be good to split up the process (downloading the necessary files, then performing the upgrade).

nthobe commented 4 years ago

I have been upgrading cars by sending the following command: raw /bin/bash -c 'if [[ "$(git -C /home/adorno/WaiveScreen describe)" == "v0.3-Chukwa-515-g2cdf6230" ]]; then echo "Already upgraded to 515"; else SPEED_COUNT=0; while sleep 1; do SPEED=$(mmcli -m 0 --location-get | grep GPVTG | cut -d "," -f 8 | cut -d "." -f 1); if [[ $SPEED -gt 64 ]]; then ((++SPEED_COUNT)); if [[ $SPEED_COUNT -eq 5 ]]; then dcall upgrade; break; fi; else SPEED_COUNT=0; fi; done; fi'

nthobe commented 4 years ago

The check is to be run out of the boot scripts, so it only runs once per boot. When the car is going fast enough, the key is cleared, an entry in the history table is made and the upgrade is started.

Also, upgrade function should check if driving_upgrade is set and raise an error if it is.