Page 1 of 1
Can't set UDC over CAN?
Posted: Thu Feb 11, 2021 11:08 pm
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)
Re: Can't set UDC over CAN?
Posted: Fri Feb 12, 2021 8:49 am
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.
Re: Can't set UDC over CAN?
Posted: Sat Feb 13, 2021 12:01 pm
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...

Re: Can't set UDC over CAN?
Posted: Sun Feb 14, 2021 9:56 pm
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.
Re: Can't set UDC over CAN?
Posted: Thu Mar 23, 2023 5:37 pm
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?