Can't set UDC over CAN?

Post Reply
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Can't set UDC over CAN?

Post by mjc506 »

Evening all,

I seem unable to set UDC from a CAN message, but setting IDC (for eample) works fine using the same message ID, start bit, bits, gain.

Seems the CAN message sets UDC, but it gets overwritten almost instantly from the analog pin. Is this intentional? (If so, I'll change the code here to remove the analog read for myself)
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Can't set UDC over CAN?

Post by johu »

udc is continously updated with the ADC value, you'd have to hack into the software to prevent that. idc is only updated in run modes, thats why you can set it in stop mode.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: Can't set UDC over CAN?

Post by mjc506 »

Gotcha, thanks.
johu wrote: Fri Feb 12, 2021 8:49 am ...idc is only updated in run modes, thats why you can set it in stop mode.
duuhhh of course... :)
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: Can't set UDC over CAN?

Post by mjc506 »

Working, thanks :)

Commented out the udcFiltered = and udcfp = lines in the ProcessUdc() function in vehiclecontrol.cpp, and added udcfp = (Param::Get(Param::udc)); in the same place (to make sure the udc limits still worked), also commented out Param::SetFlt(Param::udc, udcfp); at the bottom of that function. udc over CAN working nicely now :) Could probably either remove the udgain and offset params, or add another CAN timeout to make it neater, but that'll do for now.

I'll need to do the same for idc (there's a current sensor of HVin in my inverter) and temphs as well at some point, but should be straight forward enough.
nathaniel
Posts: 92
Joined: Thu Jun 09, 2022 10:17 am
Been thanked: 42 times

Re: Can't set UDC over CAN?

Post by nathaniel »

Is it still relevant to comment out the lines if I want to receive this value via can? A want to send the temperature via can and I suspect this works the same as the UDC.
Or if there is a can rx set on a value is the adc value disabled? If not, maybe a nice suggestion?
Post Reply