[Ovmsdev] Coding help

Shane @ Kilve Engineering shane at kilve-engineering.co.uk
Sun Oct 10 16:43:29 HKT 2021


Ok thanks Michael sorry I thought it was your doing. Ive added this to the dev mail now

BTW I do have direct with sensors in the wheels, I have fitted them myself in my summer wheels, and can read the same id’s in the tpms ecu.

If anyone has any help on how to read and write these using the shell and how to implement this it will be much appreciated

Regards
Shane Hunns


> On 10 Oct 2021, at 08:33, Michael Balzer <dexter at expeedo.de> wrote:
> 
> Shane,
> 
> first of all, just in case…: you only need to read & write tyre ID sets if you've got a "direct" TPMS with tyre integrated sensors. An indirect system using the ABS & ESP sensor readings doesn't need sensor ID sets.
> 
> I haven't used the ID set part of the tpms framework yet, my car has an indirect TPMS.
> 
> My understanding of Mark's framework is you simply need to implement the read & write hooks, i.e. OvmsVehicle::TPMSRead() & ::TMPSWrite(). They work on an uint32 vector using the same order as the wheel layout.
> 
> For inspiration, see the implementations for these hooks in the Model S (via CAN) and the Roadster (via K-Line extension board).
> 
> I've added Mark to the cc… and btw, this type of question is actually best suited for the developer list.
> 
> Regards,
> Michael
> 
> 
> Am 10.10.21 um 08:53 schrieb Shane at Kilve-Engineering.co.uk <mailto:Shane at Kilve-Engineering.co.uk>:
>> Morning Michael
>> 
>> Thank you for your email and help,
>> I think I have figured out the sensor and pressure part, but in the console the tpms command has the commands to read and write tyre Id sets
>> But it says it’s not implemented in this vehicle 
>> How do I get this implemented? Or will this work once the pressure and temps bit set up?
>> 
>> Regards
>> Shane Hunns
>> 
>> 
>>> On 9 Oct 2021, at 10:23, Michael Balzer <dexter at expeedo.de> <mailto:dexter at expeedo.de> wrote:
>>> 
>>>  Shane,
>>> 
>>> the metrics system doesn't know about the TPMS sensor IDs, you need to map them in your module.
>>> 
>>> Then simply assign the pressures and temperatures to the metrics. The default sequence is FL,FR,RL,RR.
>>> 
>>> See my mails:
>>> - http://lists.openvehicles.com/pipermail/ovmsdev/2021-January/014953.html <http://lists.openvehicles.com/pipermail/ovmsdev/2021-January/014953.html>
>>> - http://lists.openvehicles.com/pipermail/ovmsdev/2021-January/015008.html <http://lists.openvehicles.com/pipermail/ovmsdev/2021-January/015008.html>
>>> 
>>> The metrics are vector metrics, you can set single values in them by position, or simply fill a new vector and assign that as a whole. Template:
>>> 
>>> std::vector<float> tpms_health(4);
>>>>>> tpms_health[i] = read_value;
>>>>>> StdMetrics.ms_v_tpms_health->SetValue(tpms_health);
>>> 
>>> You can use "health" and/or "alert" as you like, for example with some user configurable thresholds. The "alert" metric automatically sends respective alert notifications on change.
>>> 
>>> You can test/simulate this manually by using "metrics set".
>>> 
>>> Regards,
>>> Michael
>>> 
>>> 
>>> Am 07.10.21 um 22:53 schrieb Shane @ Kilve Engineering:
>>>> Hi Michael, 
>>>> 
>>>> I see that ovms has the ability to read and write tpms ID’s 
>>>> Ive found the pressure, temp's and id’s in the maxus 
>>>> 
>>>> Can you give some guidance on how I can get the read and write id’s part added?
>>>> 
>>>> Regards
>>>> Shane
>>>> 
>>>>> On 11 Aug 2021, at 18:28, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
>>>>> 
>>>>> Shane,
>>>>> 
>>>>> simple way: override stub OvmsVehicle::CommandHomelink() with your handler.
>>>>> 
>>>>> Extensible way: implement a custom OvmsVehicle::ProcessMsgCommand(), see Twizy vehicle for an example.
>>>>> 
>>>>> Handler Template:
>>>>> 
>>>>> StringWriter res;
>>>>> MyScripts.DuktapeEvalNoResult("abrp.send(1)", &res);
>>>>> 
>>>>> Regards,
>>>>> Michael
>>>>> 
>>>>> 
>>>>> Am 11.08.21 um 19:10 schrieb Shane @ Kilve Engineering:
>>>>>> Hi Michael, 
>>>>>> 
>>>>>> I would like to use the homelink buttons on the iOS app to start and stop the ABRP scrip "script eval abrp.send(1)” & "script eval abrp.send(0)”
>>>>>> 
>>>>>> I think ive figured out the set up of the hoteling button to get it into the .cpp & .h files but dont know how to call the script from within the CPP file
>>>>>> 
>>>>>> Any help appreciated 
>>>>>> 
>>>>>> Regards
>>>>>> Shane Hunns
>>>>>> Kilve Engineering Ltd.
>>>>>> 0792 0729 316
>>>>>> 
>>>>>>> On 5 Apr 2021, at 16:01, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
>>>>>>> 
>>>>>>> Shane,
>>>>>>> 
>>>>>>> the standard deviation isn't the distance between the minimum and maximum, it's a measure of variation from the mean value.
>>>>>>> 
>>>>>>> Standard deviation is one of the main basic statistical analysis tools. Read more on this on the web: https://duckduckgo.com/?q=standard+deviation <https://duckduckgo.com/?q=standard+deviation>
>>>>>>> 
>>>>>>> In the battery chart, the standard deviation is shown as the horizontal stripe with light blue background. The maximum standard deviation observed since the last reset is shown by the two blue lines.
>>>>>>> 
>>>>>>> A high standard deviation, especially under load, means a high cell drift = defective / aged / poorly selected pack.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Michael
>>>>>>> 
>>>>>>> 
>>>>>>> Am 05.04.21 um 16:40 schrieb Shane @ Kilve Engineering:
>>>>>>>> Hi Michael look as the data below, ignoring there is some rounding up done somewhere
>>>>>>>> 
>>>>>>>> Max 4.240
>>>>>>>> Min 4.200 
>>>>>>>> 
>>>>>>>> That’s 40mv deviation
>>>>>>>> Stddev showing 4.35mv  0.00435 its one decimal place out
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Regards
>>>>>>>> Shane 
>>>>>>>> 
>>>>>>>>> On 5 Apr 2021, at 07:50, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
>>>>>>>>> 
>>>>>>>>> Shane,
>>>>>>>>> 
>>>>>>>>> what makes you think so?
>>>>>>>>> 
>>>>>>>>> Regards,
>>>>>>>>> Michael
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Am 04.04.21 um 20:47 schrieb Shane @ Kilve Engineering:
>>>>>>>>>> Hi Michael, 
>>>>>>>>>> 
>>>>>>>>>> Me again
>>>>>>>>>> It look like the bus framework does the calc incorrect? 
>>>>>>>>>> Surly stddev should be 0.0435
>>>>>>>>>> And stddev.max should be 0.0437147V 
>>>>>>>>>> 
>>>>>>>>>> v.b.p.voltage.avg 4.23496V 
>>>>>>>>>> v.b.p.voltage.grad -0.00026V 
>>>>>>>>>> v.b.p.voltage.max 4.24V 
>>>>>>>>>> v.b.p.voltage.min 4.2V 
>>>>>>>>>> v.b.p.voltage.stddev 0.00435V 
>>>>>>>>>> v.b.p.voltage.stddev.max 0.00437147V 
>>>>>>>>>> 
>>>>>>>>>> Regards
>>>>>>>>>> Shane 
>>>>>>>>>> 
>>>>>>>>>> <Screenshot 2021-04-04 at 19.45.35.png>
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> On 4 Apr 2021, at 13:26, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>> Shane,
>>>>>>>>>>> 
>>>>>>>>>>> vector metrics in general can be set by passing a vector or by using the element setters provided (see API).
>>>>>>>>>>> 
>>>>>>>>>>> But you don't need to set the cell max/min/stddev metrics at all, you only need to feed the cell voltages (and/or temperatures). The BMS framework automatically extracts all statistics values from them.
>>>>>>>>>>> 
>>>>>>>>>>> Btw, regarding your cell voltages:
>>>>>>>>>>> 
>>>>>>>>>>>> 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
>>>>>>>>>>> 
>>>>>>>>>>> This looks like 96 cells with a factor of 0.001, e.g. 0x1090 = 4240 * 0.001 = 4.24V.
>>>>>>>>>>> 
>>>>>>>>>>> Assuming you fix your IncomingPollReply() handler to actually use the rxbuf string and you copy the RXB_* macros from the Ioniq VFL code, you can simply do this to process the values:
>>>>>>>>>>> 
>>>>>>>>>>>     case 0xe113:
>>>>>>>>>>>     {
>>>>>>>>>>>       // Read battery cell voltages 1-96:
>>>>>>>>>>>       BmsRestartCellVoltages();
>>>>>>>>>>>       for (int i = 0; i < 96; i++) {
>>>>>>>>>>>         BmsSetCellVoltage(i, RXB_UINT16(i*2) * 0.001f);
>>>>>>>>>>>       }
>>>>>>>>>>>       break;
>>>>>>>>>>>     }
>>>>>>>>>>> 
>>>>>>>>>>> Doesn't look that hard, does it?
>>>>>>>>>>> 
>>>>>>>>>>> Regards,
>>>>>>>>>>> Michael
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Am 04.04.21 um 12:37 schrieb Shane @ Kilve Engineering:
>>>>>>>>>>>> morning peeps, sorry for the newbie question whats different about the cell vmax/vmin i see in metrics_standard.h its a vector?
>>>>>>>>>>>> (OvmsMetricVector<float>* ms_v_bat_cell_vmax;     // Cell maximum voltages [V])
>>>>>>>>>>>> does that mean i have ot handle these different? if so how?
>>>>>>>>>>>> as all i get is errors trying to setvalue to this metric
>>>>>>>>>>>> 
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.cpp: In member function 'void OvmsVehicleMaxed3::IncomingBmsReply(canbus*, uint16_t, uint16_t, uint8_t*, uint8_t, uint16_t)':
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.cpp:159:82: error: no matching function for call to 'OvmsMetricVector<float>::SetValue(float)'
>>>>>>>>>>>>                  StandardMetrics.ms_v_bat_cell_vmax->SetValue((float)value2 / 1000);
>>>>>>>>>>>>                                                                                   ^
>>>>>>>>>>>> In file included from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle/vehicle.h:40:0,
>>>>>>>>>>>>                  from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.h:32,
>>>>>>>>>>>>                  from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.cpp:32:
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:747:18: note: candidate: bool OvmsMetricVector<ElemType, Allocator>::SetValue(std::__cxx11::string) [with ElemType = float; Allocator = std::allocator<float>; std::__cxx11::string = std::__cxx11::basic_string<char>]
>>>>>>>>>>>>      virtual bool SetValue(std::string value)
>>>>>>>>>>>>                   ^
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:747:18: note:   no known conversion for argument 1                                                           from 'float' to 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}'
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:763:10: note: candidate: bool OvmsMetricVector<ElemType, Allocator>::SetValue(const std::vector<_Tp, _Alloc>&, metric_unit_t) [with ElemType = float; Allocator = std::allocator<float>]
>>>>>>>>>>>>      bool SetValue(const std::vector<ElemType, Allocator>& value, metric_unit_t units = Other)
>>>>>>>>>>>>           ^
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:763:10: note:   no known conversion for argument 1                                                           from 'float' to 'const std::vector<float, std::allocator<float> >&'
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.cpp:162:82: error: no matching function for call to 'OvmsMetricVector<float>::SetValue(float)'
>>>>>>>>>>>>                  StandardMetrics.ms_v_bat_cell_vmin->SetValue((float)value2 / 1000);
>>>>>>>>>>>>                                                                                   ^
>>>>>>>>>>>> In file included from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle/vehicle.h:40:0,
>>>>>>>>>>>>                  from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.h:32,
>>>>>>>>>>>>                  from /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/components/vehicle_maxus_edeliver3/src/vehicle_med3.cpp:32:
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:747:18: note: candidate: bool OvmsMetricVector<ElemType, Allocator>::SetValue(std::__cxx11::string) [with ElemType = float; Allocator = std::allocator<float>; std::__cxx11::string = std::__cxx11::basic_string<char>]
>>>>>>>>>>>>      virtual bool SetValue(std::string value)
>>>>>>>>>>>>                   ^
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:747:18: note:   no known conversion for argument 1                                                           from 'float' to 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}'
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:763:10: note: candidate: bool OvmsMetricVector<ElemType, Allocator>::SetValue(const std::vector<_Tp, _Alloc>&, metric_unit_t) [with ElemType = float; Allocator = std::allocator<float>]
>>>>>>>>>>>>      bool SetValue(const std::vector<ElemType, Allocator>& value, metric_unit_t units = Other)
>>>>>>>>>>>>           ^
>>>>>>>>>>>> /Users/shane/Open-Vehicle-Monitoring-System-3-MGEV/vehicle/OVMS.V3/main/ovms_metrics.h:763:10: note:   no known conversion for argument 1                                                           from 'float' to 'const std::vector<float, std::allocator<float> >&'
>>>>>>>>>>>> make[1]: *** [src/vehicle_med3.o] Error 1
>>>>>>>>>>>> make: *** [component-vehicle_maxus_edeliver3-build] Error 2
>>>>>>>>>>>> shane at Shanes-MacBook-Pro OVMS.V3 % 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> Regards
>>>>>>>>>>>> Shane 
>>>>>>>>>>>> 
>>>>>>>>>>>>> On 3 Apr 2021, at 12:02, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 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 <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_t obdii_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 <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>>>>> OvmsDev mailing list
>>>>>>>>>>>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>>>>>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> 
>>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>>> OvmsDev mailing list
>>>>>>>>>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>>>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> 
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> OvmsDev mailing list
>>>>>>>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> OvmsDev mailing list
>>>>>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> _______________________________________________
>>>>>>>>>> OvmsDev mailing list
>>>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> OvmsDev mailing list
>>>>>>>> OvmsDev at lists.openvehicles.com <mailto:OvmsDev at lists.openvehicles.com>
>>>>>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev <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 <http://lists.openvehicles.com/mailman/listinfo/ovmsdev>
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>>>>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>>> 
>>> 
>>> -- 
>>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
> 
> -- 
> 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/20211010/08da9e2e/attachment-0001.htm>


More information about the OvmsDev mailing list