Page 2 of 2
					
				Re: Best tactic to decode JSON data..
				Posted: Mon Dec 09, 2024 3:45 pm
				by mnfisher
				As a test - try printing the string to the display.
ie - is it received incorrectly / converted incorrectly / sent as a float incorrectly...
Try and home in on the error.
Martin
			 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Mon Dec 09, 2024 5:03 pm
				by MJU20
				As a test I already did both.
The string is shown like it should, the float doesn't have decimals.
My guess is that the ILI9488 treats the float as an integer..?
mnfisher wrote: ↑Mon Dec 09, 2024 3:45 pm
As a test - try printing the string to the display.
ie - is it received incorrectly / converted incorrectly / sent as a float incorrectly...
Try and home in on the error.
Martin
 
 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 5:37 am
				by chipfryer27
				Hi
Could you perhaps print the number as a string?
Regards
			 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 5:07 pm
				by MJU20
				Yes chipfryer27, but I need to calculate on the value so I need it as a number..
			 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 5:33 pm
				by mnfisher
				It's a silly question/thought...
If you are using the ILI9488 PrintNumber to display the value then it will, indeed, get converted to am integer.  PrintNumber takes an Int (so just 16 bits too)  - and no digits after the point!
Martin
			 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 10:52 pm
				by MJU20
				Oh my, you are right again.
My life is hell 
 
After all this time still make these mistakes, I was pretty sure that it took a Float too.
Now I really have a problem because I want to show the the number with only one decimal and need to calculate with this number.
I will work it out, but it should be great to have a component that shows all kinds of numbers, I know this is a lot of work...
Will figure it out.
Thank you again Martin! 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 11:05 pm
				by mnfisher
				We got there in the end....
Easily done - see my post this evening about trying to fit 16 bits of data into a byte 

 Sometimes it just needs a different pair of eyes.
You could have a macro PrintFloat - that takes a float x (and possibly number of digits after dp) and a position - convert x to a string using FloatToString$ - then print the string....
Martin
 
			
					
				Re: Best tactic to decode JSON data..
				Posted: Tue Dec 10, 2024 11:49 pm
				by chipfryer27
				Hi
You can limit the number of decimal places
viewtopic.php?p=7248&hilit=number+of+de ... aces#p7248
You could use that for calculations, and then print.
Regards