Skip to content

Commit

Permalink
remove very first sample on new firmware file transfer to prevent bad…
Browse files Browse the repository at this point in the history
… data sometimes
  • Loading branch information
Corbeno committed May 6, 2023
1 parent 51c15f6 commit c81c3d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ def _stop_sampling(self, outFile=None):
except Exception as e:
self._print_to_output("Error opening file!", config.WRAPPER_ERROR)
return
# TODO move these to a seperate functions to keep it clean

# old firmware uses serial to get samples, new firmware can use SCP for faster transfer
if self.cmd_obj.ctrl_comm_obj.old_firmware:
self._print_to_output("Fetching samples...", config.WRAPPER_INFO)
self.cmd_obj.send_fetch()
Expand Down Expand Up @@ -525,6 +526,11 @@ def _stop_sampling(self, outFile=None):

# read from temp data.bin, and write sample file to given file locaiton
with open(config.SCP_LOCAL_PATH, "rb") as temp_file:

# first sample taken after bootup on new firmware reads as 0 always for some reason.
# couldn't fix on firmware, so just dropping it always
temp_file.read(2)

while True:
raw_num = temp_file.read(2)

Expand Down

0 comments on commit c81c3d2

Please sign in to comment.