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

Fixes 'jq' try to read settings_auto.json warning in logs #548

Merged
merged 3 commits into from
Oct 4, 2021

Conversation

linuxkidd
Copy link
Collaborator

Fixed in two steps:

  • If CAMERA is still set to auto after reading autocam.sh from config.sh, don't try to read the camera settings, instead set default debug level 0.
  • In allsky.sh, if auto camera detection was selected, and we detect a camera, re-read debug level from the proper camera settings file.

@linuxkidd
Copy link
Collaborator Author

Don't merge yet... I'm seeing another oddity that I want to run down. May be more commits coming.

@linuxkidd
Copy link
Collaborator Author

Ok, found and fixed my other issue -- was a local test gone wrong ... this PR is safe to commit.

@linuxkidd
Copy link
Collaborator Author

Ok, there was a bug in the earlier commit -- using -eq and -ne for text comparison in Bash. Fixed now.

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Michael,
Have you tried this on your Pi? I'm not sure the config.sh change will work. If $CAMERA=auto it won't set CAMERA_SETTINGS and all jq commands will fail.
Or am I missing something?

If it DOES work, you can delete the "fi" on line 123 and change the "if" on 125 to "else". You already checked for CAMERA=auto on 120 so no need for another check on 125.

@linuxkidd
Copy link
Collaborator Author

linuxkidd commented Oct 4, 2021

HI @EricClaeys -- actually, the double check of CAMERA is intentional.

It's how the script detects that the contents of autocam.sh didn't actually set the CAMERA variable.

New logic:

  • allsky.sh is ran, and wipes the autocam.sh contents
  • then sources config.sh.
  • The end of config.sh attempts to source autocam.sh but it's empty
  • Since it's empty, CAMERA != "auto" is false and it skips setting CAMERA_SETTINGS and ALLSKY_DEBUG_LEVEL
  • allsky.sh does it's camera auto-detection and:
    • Populates autocam.sh
    • sets CAMERA_SETTINGS
    • ALLSKY_DEBUG_LEVEL

Since autocam.sh has been populated now, any future runs of config.sh will test true on CAMERA != "auto", and will have the CAMERA_SETTINGS and ALLSKY_DEBUG_LEVEL set properly.

To the first question - yes, it's running on my Pi right now. :)

@EricClaeys
Copy link
Collaborator

Thanks for the explanation Michael. Let's hope Thomas agrees we can dump the CAMERA=auto, in which case we don't need this and we can use ALLSKY_DEBUG_LEVEL as soon as config.sh is sourced in to allsky.sh, rather than after the camera detection is done.

@linuxkidd linuxkidd merged commit c8c03aa into AllskyTeam:master Oct 4, 2021
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

Successfully merging this pull request may close these issues.

2 participants