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

Save GPS Lat/Lon on SD Card #104

Open
mariopesch opened this issue Mar 12, 2019 · 3 comments · Fixed by #134
Open

Save GPS Lat/Lon on SD Card #104

mariopesch opened this issue Mar 12, 2019 · 3 comments · Fixed by #134
Labels
bug Something isn't working

Comments

@mariopesch
Copy link
Member

Reporting a Bug

When saving Lat and Lon from the gps on SD Card on 2 Decimals are shown.

Expected Behavior

All Decimals from the coordinates need to be stored on the sd card.

Current Behavior

Only 2 decimals are stored on the sd card

Possible Solution

  1. Detect the TYPE of the Input Block and adjust the code to dataFile.println(value,6)
  2. Change the return type of the values from the senseBox Lib. Maybe convert from float to char?
@mariopesch mariopesch added the bug Something isn't working label Mar 12, 2019
@mariopesch
Copy link
Member Author

New suggestion is to give the option to setup the number of decimals in the sd card and print on serial monitor block. The default value will is 2

@Lucas-Steinmann
Copy link

Another possibility would be to have a number to string format block.
While not complex to implement it would change the interface and I think that's frozen until the release of the book?
Furthermore it is an additional, albeit optional, complexity for the user.

New suggestion is to give the option to setup the number of decimals in the sd card and print on serial monitor block. The default value will is 2

This would also trigger an interface change.
I would suggest that the new "Format-Block" is better since it separates the concerns.
As a result we would have a generic solution, which applies to printing in general (e.g. also display), reduce the complexity of the other blocks (here SD card and Serial Monitor) and the size of the block code, if the format is not needed (no additional option).

Detect the TYPE of the Input Block and adjust the code to dataFile.println(value,6)

Not sure whether dataFile.println(value,6) would work as expected. I can currently not try it, but the Arduino docs, does not list that as an option.
If working, or otherwise by using dataFile.printf("%.6f\n", value), the advantages would be:

  • no change in the interface
  • very easy to implement
  • no additional complexity for the user

Disadvantages, which I can think of, would be:

  • only affects SD card (eg. Serial print or Display would still only show two decimals)
  • all floats would be saved with 6 decimal

Change the return type of the values from the senseBox Lib. Maybe convert from float to char?

Probably char*, or?
Pro:

  • no change in the interface
  • very easy to implement
  • no additional complexity for the user

Con:

  • also affects user not using blockly (and maybe annoying them)
  • I did not find a string to float function in blockly. If the user wants to do some calculation with the output, he can't. Probably not so much with longitude and latitude but with speed and height (not sure if the output type can be different for different options.

@mariopesch
Copy link
Member Author

mariopesch commented Sep 23, 2019

The PR #134 does not fix the issue completely. Only if the Block is used directly as an input for the SD Block the number of decimals will be adjusted. If a user assigns a variable to the lat and lng values and tries to save this to sd card the issue still exists!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants