Page 1 of 1

HC-SR04 shows only integer values

Posted: 31 Dec 2016, 07:22
by Rampler
Hello together,
i am using Ultrasonic Sensor - HC-SR04 with WEMOS D1 mini V2 and ESPEasy R147 RC8.
In the log i see:

Code: Select all

1119107 : SR04 : Distance: 28.44
for example.
In the web interface, i get only integer values (28). Also via MQTT.
Is this a bug, or can i adjust it ?
regards
Klaus

Re: HC-SR04 shows only integer values

Posted: 31 Dec 2016, 11:17
by Rampler
Also interesting would be, if anybody gets the whole values, including the digits after commata ?

Re: HC-SR04 shows only integer values

Posted: 01 Jan 2017, 00:54
by nick-head
I had the same as you at the beginning, but I edited the plugin to see what happens.

I don't know what I am doing or wether it should be done but I got it to display decimals.

[img]
SR04 Modded.JPG
SR04 Modded.JPG (76.37 KiB) Viewed 6667 times
[/img]

Re: HC-SR04 shows only integer values

Posted: 01 Jan 2017, 09:40
by Rampler
Good to hear that it is possible !!
I assume, you have done your own firmware, right ?
I am using the last unstable R147 RC8.
In my opinion, this should be changed in the offical firmware, like voltage settings (here you can choose, how many digits do you want to have).
Is there a tool, which i can build the firmware in an easy way ?

regards
Klaus

Re: HC-SR04 shows only integer values

Posted: 01 Jan 2017, 10:45
by nick-head
Hi Klaus,

All I used was the Arduino IDE on Windows 7.

I just loaded the source code of ESPEasy and edited the _P013_HCSR04.ino plugin.

Then recompile and send it to the ESP.

Just found out it is not the Mega Version, just V147

Re: HC-SR04 shows only integer values

Posted: 01 Jan 2017, 11:13
by Rampler
Hi Nick,
ok, i will give it a try...
Many Thanks...

regards
Klaus

Re: HC-SR04 shows only integer values

Posted: 09 Jan 2017, 10:57
by nick-head
So then Klaus, did it work ?

Re: HC-SR04 shows only integer values

Posted: 09 Jan 2017, 12:47
by Rampler
Hi Nick,
yes it is working fine now, thanks again..
Hopefully, this will find the way in the official version ..

best reagrds
Klaus