Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False "Firmware update is needed" on failed Bullseye installs #319

Open
slowrunner opened this issue Apr 23, 2022 · 1 comment
Open

False "Firmware update is needed" on failed Bullseye installs #319

slowrunner opened this issue Apr 23, 2022 · 1 comment

Comments

@slowrunner
Copy link
Contributor

slowrunner commented Apr 23, 2022

When an update_gopigo3.sh install to Bullseye fails, the “check_if_firmware_upgrade_needed” will fail instantiating a GoPiGo3 because the setuptools was not present to install the gopigo3 egg files. When that instantiation fails because of the missing modules, the check executes the exception clause which improperly states “Firmware Upgrade Is Needed”

try:
        g = gopigo3.GoPiGo3()
        current_firmware = g.get_version_firmware()
        if current_firmware == available_firmware:
                print(f"\nThe GoPiGo is already running the latest firmare: {current_firmware}. \nAn upgrade is not needed at this time.\n")
                exit(1)
except Exception as e:
        print(e)
        print("Firmware upgrade is needed")
        exit(0)

While the end of the installation does give an error, many folks do not seem to read it.

GOPIGO3 SOFTWARE INSTALLATION FAILURE: +Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'gopigo3'
Suggest installing over Legacy Pi OS (Buster).

========
Suggestion for check_if_firmware_update_is_needed.py
move the firmware upgrade needed notice to an else clause:

...
 if current_firmware == available_firmware:
                print(f"\nThe GoPiGo is already running the latest firmware: {current_firmware}. \nAn upgrade is not needed at this time.\n")
                exit(1)
 else:
        # print("Firmware upgrade is needed")
        print(f"\nThe GoPiGo3 is running firmware: {current_firmware}.  An upgrade to {available_firmware} is needed.\n")
        exit(0)

except Exception as e:
        print(e)
        exit(0)
@jharris1993
Copy link
Contributor

Isn't zero a successful exit code?

Why does the successful exit, exit with a "1" and the errors exit with a "0"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants