[Ovmsdev] Coding help

Shane@Kilve-Engineering.co.uk shane at kilve-engineering.co.uk
Sun Apr 4 00:02:05 HKT 2021


Thanks Henrik

every bit helps

Regards
Shane

> On 3 Apr 2021, at 12:33, henrik.scheel at spjeldager.dk wrote:
> 
> 
> Each byte is a cell-bundle voltage, and you simply multiply the byte value with 0.02
> 
> See https://github.com/langemand/SoulEVSpy/blob/master/app/src/main/java/com/evranger/soulevspy/util/BatteryManagementSystemParser.java
> 
> Best regards, 
> Henrik
> --
> Best regards / venlig hilsen
> Henrik Scheel
> Mobil: +45 2720 9828
> 
> 
> -------- Oprindelig besked --------
> Fra: ovmsdev-request at lists.openvehicles.com
> Dato: lør. d. 3. apr. 2021 13.02
> Til: ovmsdev at lists.openvehicles.com
> Emne: OvmsDev Digest, Vol 111, Issue 9
> Send OvmsDev mailing list submissions to
> ovmsdev at lists.openvehicles.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> or, via email, send a message with subject or body 'help' to
> ovmsdev-request at lists.openvehicles.com
> 
> You can reach the person managing the list at
> ovmsdev-owner at lists.openvehicles.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of OvmsDev digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: Coding help (Michael Balzer)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sat, 3 Apr 2021 13:02:06 +0200
> From: Michael Balzer <dexter at expeedo.de>
> To: ovmsdev at lists.openvehicles.com
> Subject: Re: [Ovmsdev] Coding help
> Message-ID: <53c8b247-77d8-b272-5c6d-a815c5aa413f at expeedo.de>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
> 
> OVMS# obd can1 request device -t1000 7e4 7ec 2102
> 7e4[7ec] 2102: Response:
> ff ff ff ff c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c5 | ................
> c5 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 | ................
> c4 c4 c4 c4???????????????????????????????????? | ....
> 
> OVMS# obd can1 request device -t1000 7e4 7ec 2103
> 7e4[7ec] 2103: Response:
> ff ff ff ff c4 c4 c4 c4 c4 c4 c4 c5 c5 c4 c4 c4 | ................
> c4 c4 c4 c4 c4 c5 c5 c5 c4 c5 c5 c5 c4 c5 c4 c4 | ................
> c5 c4 c4 c4???????????????????????????????????? | ....
> 
> OVMS# obd can1 request device -t1000 7e4 7ec 2104
> 7e4[7ec] 2104: Response:
> ff ff ff ff c4 c4 c5 c4 c4 c4 c4 c4 c4 c4 c4 c4 | ................
> c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 c4 | ................
> c4 c5 c4 c4???????????????????????????????????? | ....
> 
> 
> Your voltages obviously are 16 bit values, so you'll need to use 
> RXB_UINT16() and multiply your loop index by 2.
> 
> Regards,
> Michael
> 
> 
> Am 03.04.21 um 12:04 schrieb Shane @ Kilve Engineering:
> > Hi has anyone got a sample of the data for the cell voltages on the 
> > ioniq vfl just so I can see how the macro is handling it? Or is it 
> > played out the same as below?
> >
> > Regards
> > Shane
> >
> >> On 29 Mar 2021, at 22:20, Michael Balzer <dexter at expeedo.de 
> >> <mailto:dexter at expeedo.de>> wrote:
> >>
> >> Shane,
> >>
> >> Am 29.03.21 um 20:17 schrieb Shane @ Kilve Engineering:
> >>> can any one tell me what the "v.e.c.login" is and is it need for 
> >>> something to work?
> >>
> >> v.e.c.config yes = ECU/controller in configuration state
> >>
> >> It's not used by the framework currently.
> >>
> >>> also any one with any ideas how to deal with cell voltages in a 
> >>> string this long? ?took me blumim ages to find the bms when the tx 
> >>> and rx are 128 address apart!!
> >>>
> >>> 748[7c8]:e113 10 90 10 92 10 93 10 93 10 8e 10 92 10 8f 10 90 10 92 
> >>> 10 6c 10 93 10 93 10 8f 10 91 10 92 10 92 10 92 10 92 10 92 10 92 10 
> >>> 90 10 8e 10 90 10 92 10 8d 10 90 10 91 10 8f 10 8e 10 8f 10 91 10 90 
> >>> 10 90 10 91 10 8e 10 91 10 8e 10 91 10 90 10 8e 10 90 10 92 10 90 10 
> >>> 94 10 91 10 91 10 93 10 90 10 91 10 90 10 8f 10 93 10 92 10 8e 10 90 
> >>> 10 91 10 8b 10 92 10 90 10 91 10 8e 10 90 10 90 10 90 10 91 10 90 10 
> >>> 8f 10 90 10 90 10 8e 10 92 10 8e 10 91 10 89 10 91 10 91 10 91 10 8d 
> >>> 10 8f 10 8d 10 86 10 8a 10 8e 10 8f 10 91 10 90 10 92 10 94 10 88 10 
> >>> 8f 10 94 10 91 10 91 10 91 10 93 10 91 00 00 00 00 00 00 00 00 00 00 
> >>> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> >>
> >> Simply loop over the cells contained. Have a look at the buffer macro 
> >> utils, e.g.:
> >> https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_hyundai_ioniqvfl/src/vehicle_hyundai_ioniqvfl.cpp#L44
> >>
> >> Regards,
> >> Michael
> >>
> >>
> >>> Shane
> >>>
> >>>
> >>>
> >>>> On 5 Mar 2021, at 20:45, Michael Balzer <dexter at expeedo.de 
> >>>> <mailto:dexter at expeedo.de>> wrote:
> >>>>
> >>>> Shane,
> >>>>
> >>>> OvmsVehicle::PollSetPidList(m_can1, obdii_polls);
> >>>> ? ? OvmsVehicle::PollSetState(0);
> >>>>
> >>>> needs to be done in your vehicle init, i.e. the constructor after 
> >>>> RegisterCanBus().
> >>>>
> >>>> Please read the vehicle_obdii module source for a complete polling 
> >>>> example.
> >>>>
> >>>> Regards,
> >>>> Michael
> >>>>
> >>>>
> >>>> Am 05.03.21 um 17:59 schrieb Shane @ Kilve Engineering:
> >>>>> Thanks Michael,
> >>>>>
> >>>>> Had a try and ended up with this bit added but return anything
> >>>>>
> >>>>> Where am I going wrong?
> >>>>>
> >>>>> Shane
> >>>>>
> >>>>> *******
> >>>>>
> >>>>> #include "ovms_log.h"
> >>>>> *static**const**char**TAG= "v-edeliver3";
> >>>>>
> >>>>> #include "vehicle_edeliver3.h"
> >>>>> #include "metrics_standard.h"
> >>>>>
> >>>>> *namespace*? {
> >>>>>
> >>>>> *const*OvmsVehicle::poll_pid_tobdii_polls[] =
> >>>>> {
> >>>>> ? ? { 0x7e3, 0x7eb, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0xf194, { 10, 
> >>>>> 10, 10, 10 }, 0, ISOTP_STD }, //VIN
> >>>>> ? ? { 0x7e3, 0x7eb, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0xe003, { 10, 
> >>>>> 10, 10, 10 }, 0, ISOTP_STD }, //SOH
> >>>>> POLL_LIST_END
> >>>>> };
> >>>>> };
> >>>>>
> >>>>> OvmsVehicleEdeliver3::OvmsVehicleEdeliver3()
> >>>>> ? {
> >>>>> ? ? ESP_LOGI(TAG, "Start eDeliver3 vehicle module");
> >>>>>
> >>>>> RegisterCanBus(1,CAN_MODE_ACTIVE,CAN_SPEED_500KBPS);
> >>>>> ? }
> >>>>>
> >>>>> OvmsVehicleEdeliver3::~OvmsVehicleEdeliver3()
> >>>>> ? {
> >>>>> ? ? ESP_LOGI(TAG, "Stop eDeliver3 vehicle module");
> >>>>>
> >>>>> memset(m_vin, 0, *sizeof*(m_vin));
> >>>>> ? }
> >>>>>
> >>>>>
> >>>>> //testing polls
> >>>>>
> >>>>> *void*OvmsVehicleEdeliver3::IncomingPollReply(
> >>>>> ?? canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, 
> >>>>> uint8_t length, uint16_t mlremain)
> >>>>> {
> >>>>> string& rxbuf = med_obd_rxbuf;
> >>>>>
> >>>>> OvmsVehicle::PollSetPidList(m_can1, obdii_polls);
> >>>>> OvmsVehicle::PollSetState(0);
> >>>>>
> >>>>>
> >>>>> // init / fill rx buffer:
> >>>>> *if* (m_poll_ml_frame == 0) {
> >>>>> rxbuf.clear();
> >>>>> rxbuf.reserve(length + mlremain);
> >>>>> ?? }
> >>>>> rxbuf.append((*char**)data, length);
> >>>>> *if* (mlremain)
> >>>>> *return*;
> >>>>>
> >>>>> // complete:
> >>>>> *switch* (pid) {
> >>>>> *case* 0xe003: {
> >>>>> *unsigned* *int* soh_raw = ((*unsigned* *int*)rxbuf[0] << 8) | 
> >>>>> (*unsigned* *int*)rxbuf[1];
> >>>>> *float* soh = soh_raw / 10;
> >>>>> StdMetrics.ms_v_bat_soh->SetValue(soh);
> >>>>> *break*;
> >>>>> ?? ? }
> >>>>> ?? }
> >>>>> }
> >>>>>
> >>>>>
> >>>>> // end testing polls
> >>>>>
> >>>>>
> >>>>>
> >>>>>> On 5 Mar 2021, at 12:37, Michael Balzer <dexter at expeedo.de 
> >>>>>> <mailto:dexter at expeedo.de>> wrote:
> >>>>>>
> >>>>>> Shane,
> >>>>>>
> >>>>>> on OBD polling basics: 
> >>>>>> http://lists.openvehicles.com/pipermail/ovmsdev/2020-December/014758.html
> >>>>>>
> >>>>>> Regards,
> >>>>>> Michael
> >>>>>>
> >>>>>>
> >>>>>> Am 04.03.21 um 19:45 schrieb Shane @ Kilve Engineering:
> >>>>>>> Good evening Michael,
> >>>>>>>
> >>>>>>> Or any one that has the time to help,
> >>>>>>>
> >>>>>>> Ive now successfully retrieved as much info as I can without 
> >>>>>>> polling any info for the maxus, but I have have now found an ecu 
> >>>>>>> that responds to pid requests.
> >>>>>>>
> >>>>>>> For example if I use the obdii pid scanner I get the loads of 
> >>>>>>> data back and I?ve decoded some of it, just need a bit of 
> >>>>>>> guidance how to write the code to get the same info
> >>>>>>>
> >>>>>>> A part of a scan is as follows
> >>>>>>>
> >>>>>>> Scan complete (7e3 e000-e100)
> >>>>>>> Scan started : 2021-03-04 18:32:36 GMT
> >>>>>>> Last response: 2021-03-04 18:32:39 GMT
> >>>>>>> 7e3[7eb]:e000 00
> >>>>>>> 7e3[7eb]:e001 64
> >>>>>>> 7e3[7eb]:e002 4b
> >>>>>>> 7e3[7eb]:e003 26 bc
> >>>>>>> 7e3[7eb]:e004 00 07
> >>>>>>> 7e3[7eb]:e005 2f
> >>>>>>> 7e3[7eb]:e006 2e
> >>>>>>> 7e3[7eb]:e007 02 00
> >>>>>>> 7e3[7eb]:e008 01 ff
> >>>>>>> 7e3[7eb]:e009 02 00
> >>>>>>> 7e3[7eb]:e010 02 00
> >>>>>>>
> >>>>>>> I know that e003 is SOH = 26bc = 9916 /100 = 99.16% SOH
> >>>>>>> And e002 is a temp 4b = 75 / 10 = 7.5 degrees
> >>>>>>>
> >>>>>>> So if some one can help me with an example of how to correctly 
> >>>>>>> code this one I can work out the rest,
> >>>>>>>
> >>>>>>> Ive looked through various vehicles but everyone uses different 
> >>>>>>> methods and I can?t seem to get one to work for me.
> >>>>>>>
> >>>>>>> Any help much appreciated
> >>>>>>>
> >>>>>>> Shane
> >>>>>>>
> >>>>>>>> On 15 Feb 2021, at 08:05, Michael Balzer <dexter at expeedo.de 
> >>>>>>>> <mailto:dexter at expeedo.de>> wrote:
> >>>>>>>>
> >>>>>>>> Shane,
> >>>>>>>>
> >>>>>>>> I forgot to mention: if you're working on a new vehicle module, 
> >>>>>>>> you'll also need to start the bus somewhere in your 
> >>>>>>>> initialization code. Example:
> >>>>>>>>
> >>>>>>>> ? RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);
> >>>>>>>>
> >>>>>>>> Regards,
> >>>>>>>> Michael
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> Am 15.02.21 um 08:36 schrieb Michael Balzer:
> >>>>>>>>> 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 
> >>>>>> <mailto:OvmsDev at lists.openvehicles.com>
> >>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> OvmsDev mailing list
> >>>>> OvmsDev at lists.openvehicles.com
> >>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> >>>>
> >>>> -- 
> >>>> 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 <mailto:OvmsDev at lists.openvehicles.com>
> >>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> >>>
> >>>
> >>> _______________________________________________
> >>> OvmsDev mailing list
> >>> OvmsDev at lists.openvehicles.com
> >>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> >>
> >> -- 
> >> 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 <mailto:OvmsDev at lists.openvehicles.com>
> >> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> >
> >
> > _______________________________________________
> > OvmsDev mailing list
> > OvmsDev at lists.openvehicles.com
> > http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> 
> -- 
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210403/32a783ba/attachment.htm>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: OpenPGP_signature
> Type: application/pgp-signature
> Size: 203 bytes
> Desc: OpenPGP digital signature
> URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210403/32a783ba/attachment.sig>
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
> 
> 
> ------------------------------
> 
> End of OvmsDev Digest, Vol 111, Issue 9
> ***************************************
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210403/969ac27f/attachment-0001.htm>


More information about the OvmsDev mailing list