Gauge widget data mapping question

Hello!

Not sure if the data mapping is intended to work like this?

Use case:

My moisture sensor returns values from 240 to 610, where the first is 0% and last is 100%. In order to get this range you have to do the calibration your self (check the value when dry, check the value when put in water), which means that the returned moisture value could sometimes go little above 610 or below 240…anyway (just a small introduction)

I use the gauge widget to display moisture, i put in the data mapping range 240 and 610 (I also press on the line between the two values to make that strange a circle inside). When the sensor send 312 for example, the gauge displays 430. Seems like its not always mapping from 0 to 100?

P.S. If you remove the strange circle between the mapping range, and with an value of 312 the gauge fills around 20% which is correct, I only need just the correct value (20) which I don’t get :frowning:

Kind regards

I think I’d do the processing of the values before sending them to Blynk.
Deduct 240 from your result, then divide it by 3.7 (because there are 370 steps between 240 and 610, so 1% = 3.7).
You may need to round the result before sending it to your gauge widget.

Pete.

Mapping differs on the base of the pin:

PWM pins provide mapping of entered value to 0-255 (could vary on different boards)
Analog pins provide mapping of entered value to 0-1023 (could vary on different boards)
Virtual pins - mapping is working from -9999 to 9999

For your case it is better to disable mapping in Blynk and update your sketched with mapping calls on it’s side

@BlynkAndroidDev Thanks for the info, wondering just would it be more useful to do the mapping for virtual pins from 0 to 100. What is the use case for mapping from -9999 to 9999 and what is your guess how many people use it this way and how many people would use it if it would map from 0 to 100.

@PeteKnight this is what i do now, but I wanted to give the client the option to set the range without any additional input fields. Would be a clean way if it supported mapping from 0 to 100 and not from -9999 to 9999

Kind Regards

Well, if you’re using Blynk commercially then you should be signing-up to one of the subscription plans. If you do that then the Blynk team will help you with your code and most likely give you a way for your client to enter the parameters they need.

Pete.

Client in terms of server/client. :smiley: