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

Fixed GPS timestamp + new logging feature + more #82

Merged
merged 3 commits into from
May 15, 2024

Conversation

AarjavJain101
Copy link
Contributor

@AarjavJain101 AarjavJain101 commented May 11, 2024

EDITS:

  • May 12th: Fixed log upload functionality to look in the failfiles/ folder instead of the logfiles/ folder because the location of parse fails has changed to failfiles/ now. Done by changing LOG_DIRECTORY to FAIL_DIRECTORY as the file search location in the upload_logs function.

Purpose:

  • Previous GPS messages were printed as 025914 or 112548. Upon closer inspection this is actually just HHMMSS. Thus, this branch fixed the timestamp from printing "025914" to "2024-05-11 02:59:14.000", for example. Note that the date is decided using time.time() to get the current epoch time and then this is rounded down to a whole day. It is onto this rounded down timestamp the GPS timestamp is added. This needed to be done because GPS only provides the hours, minutes, and seconds in GMT. See this Monday update for more details.
  • Major changes in logging messages and printing them. This was all to improve debugging because I noticed some simple quality of life changes for when a flurry of messages is displayed during testing. The goal was to track, separate, and provide options for logging certain messages to make the debugging process more streamlined. See the Changes below for more details.

Changes:

  • A mistake in the user/Aarjavjain101/log_dbg_fails branch was fixed in which the dbgfiles directory was not created when link telemetry was ran with the -u option for the first time. To fix this, the logic to perform log uploading was put after creating the necessary directories. Additionally, a small error in which the pretty printed parse fail message would go to the logfiles folder instead of the dbgfiles folder was fixed by switching the directory arguments in the write_to_log_files function.
  • In the GPS data class, the necessary functions to format the timestamp correctly were implemented and tested with synced GPS data coming over radio and observing the timestamps:
    image
  • GPS data going to Influx, however, is still an epoch time in GMT.
  • Updated API.md to match new logMessage field of JSON response. This field tells link_telemetry whether to log the pretty printed table + raw message or not.
  • We will now use BeautifulTable instead of PrettyTable because of a new change to the display data section. Essentially, there is now more flexibility in displaying data as either rows or columns. This is to accommodate the Raw Hex field as Pretty Table could not support this. Also, there is much more customizability with beautiful table. Note that there is a warning being suppressed for using attributes which will be deprecated in the future (v1.2.0 of beautiful table but I updated requirements.txt to so that we use v1.1.0).
    image
    image
  • Fixed write_to_log_file function to be able to write the beautiful table into the log file (encoding issues previously due to latin-1).
  • Changed logic used to print tables in process_response function to match new BeautifulTable.
  • There are now 3 logging folder. dbgfiles is the folder containing pretty printed parse fails response from a session. The failfiles folder contains the raw hex messages which were failed from a session (just dbgfail but raw message this time). Instead of including these into one file/folder (why have two separate folder for parse fails) I separated them because it makes spotting patterns in message data a lot easier than scrolling through the verbose parse fail explanations. Lastly, logfiles folder is filled with beautiful table messages that are printed to the terminal only if you specified those messages to be logged. The arguments for what can be logged work the same as for live stream filters (see README.md for more info).
  • Removed -l for live streaming in README.md because I made -l be associated with logging messages functionality instead. You need to use --live-on arg1 arg2.... now for live streaming.
  • Created a new requirements.txt due to installing beautifultable. This needs to be tested.

Next Steps:

  • Need to run full test again on Sunday (maybe) to verify firmware_v3 get_current_timestamp inside interrupt handler changes.
  • Add/modify DATA_CLASSES.md to match new ROW and COL implementation of display data.
  • Update README.md to explain --log usage.
  • Test out new requirements.txt

Copy link
Contributor

@ishanjoshi23 ishanjoshi23 left a comment

Choose a reason for hiding this comment

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

Looks good

@ishanjoshi23 ishanjoshi23 merged commit 58a3b9e into main May 15, 2024
1 check passed
@AarjavJain101 AarjavJain101 deleted the user/Aarjavjain101/add_log_all_option branch May 19, 2024 06:29
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.

None yet

2 participants