Hi, i implement the following code into the FW: unsigned int soc_largest = 56028; // this is from mark, readout from the logs unsigned int soc_smallest = 13524; // this too unsigned int v; v = (can_databuffer[1]+(unsigned int) can_databuffer[0] << 8); if ((v<soc_smallest)&&(v>0)) v=soc_smallest; if (v>soc_largest) v=soc_largest; car_SOC = (char)((v-soc_smallest)/((soc_largest-soc_smallest)/100)); i got funny Outputs in the iPhone app. Something between 0 and 100%. Not match to the real state. Full can display as 0% or 20, or...... Empty can show as 100%, or something else. This code (org. mark) works: car_SOC = (char)((can_databuffer[1]+((unsigned int) can_databuffer[0] << 8))/644); With this i got 21-87% for the soc. BTW: i thing it is a good idea to deactivate the minSOC warning. It is not nessary for the Volt/Ampera. I activate the internal GPS (OVMS_INTERNALGPS) and get the position from my car. GREAT WORK. I got no Info about the VIN, the OVMS FW and the car type in the iPhone App. 1.3.2 build from the git. Bye michael
Hi Michael, Am 29.11.2012 20:15, schrieb Michael Jochum:
v = (can_databuffer[1]+(unsigned int) can_databuffer[0] << 8);
That's an annoying C logic trap: + has precedence over <<. v = can_databuffer[1]+((unsigned int) can_databuffer[0] << 8); ...should do. Regards, Michael -- Michael Balzer * Paradestr. 8 * D-42107 Wuppertal Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
Hi Michael, you are right. I change it. And now it looks that it works. In the original code the clamps were there. I dont know why they gone lost. THX Bye Michael Am 29.11.2012 um 23:59 schrieb Michael Balzer <dexter@expeedo.de>:
Hi Michael,
Am 29.11.2012 20:15, schrieb Michael Jochum:
v = (can_databuffer[1]+(unsigned int) can_databuffer[0] << 8);
That's an annoying C logic trap: + has precedence over <<.
v = can_databuffer[1]+((unsigned int) can_databuffer[0] << 8);
...should do.
Regards, Michael
-- Michael Balzer * Paradestr. 8 * D-42107 Wuppertal Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
<dexter.vcf>_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
participants (3)
-
Michael Balzer -
Michael Jochum -
mikeljo@me.com