Git Product home page Git Product logo

Comments (3)

mariopesch avatar mariopesch commented on August 19, 2024

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

from ardublockly-1.

Lucas-Steinmann avatar Lucas-Steinmann commented on August 19, 2024

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.

from ardublockly-1.

mariopesch avatar mariopesch commented on August 19, 2024

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!

from ardublockly-1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.