[Ovmsdev] Coding help

Shane @ Kilve Engineering shane at kilve-engineering.co.uk
Mon Feb 15 17:49:41 HKT 2021


Morning Michael, 

Thank you for taking the time to reply, I did get there in the end and now have battery soc and pack voltage in the app, :-) 

Your suggestion helped me tidy up my work thanks. 

Just need to work out a few more and then get some help how to do a pull request and get a graphic of the vehicle in the app

Regards 

Shane

> On 15 Feb 2021, at 07:36, Michael Balzer <dexter at expeedo.de> wrote:
> 
> Shane,
> 
> Am 14.02.21 um 16:42 schrieb Shane @ Kilve Engineering:
>> can any one help me with a bit of code to retrieve ve some data from ecu can1/6f2  00 4c 00 00 01 97 bc 00 as i cant poll this ecu it just broadcasts when its active, ive tried polling it but does not respond, i need to choose one byte and allocate it to a PID.
> 
> I don't know what you mean by "allocating a byte to a PID", but if you want to process frames received directly, simply override IncomingFrameCan1() (or …2/3/4 depending on your bus).
> 
> Reduced example:
> 
> void OvmsVehicleXYZ::IncomingFrameCan1(CAN_frame_t *p_frame)
> {
>   uint8_t *d = p_frame->data.u8;
> 
>   switch (p_frame->MsgID)
>   {
>     case 0x6f2:
>       // for example, assuming the SOC is in byte 1:
>       StdMetrics.ms_v_bat_soc->SetValue(d[1]);
>       break;
>   }
> }
> 
> If you're outside a vehicle context, you can register your own CAN receiver by creating a queue and calling MyCan.RegisterListener(). See the vehicle module for an example.
> 
> Regards,
> Michael
> 
> -- 
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
> 
> 
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev



More information about the OvmsDev mailing list