I have 4 analog switches connected via an ADC (so you get 1V / 2V / 3 V / 4V / 5V depending on which switch you press) which is exposed via a CAN input channel (BUTTONS_ADC11).
I have made functions for each of the buttons that detect when the BUTTONS_ADC11 is in the correct voltage range (e.g. 3V +/- 0.2V) and then under Configuration > Buttons > xxx - channel I choose the function the for button I want assigned (e.g. f_btn_up and f_btn_dn).
I struggled a bit to get it to work, for two reasons:
The “divisor” and “Decimal places” are dividing your input cumulative. The BUTTONS_ADC11 is a 16bit signed number in mV, but putting divisor=1000 and Decimal places=3 made the ADU think the voltage was in uV, not mV. Only use divisor when Decimal places isn’t scaling the number the correct way.
To get the buttons to go to the next/previous page, the engine has to be running(!). I only figured this out yesterday. Maybe there’s a way around this.
I’m assuming the CAN buttons can be assigned much the same as digital or analogue switches..
Odd that engine has to be running for next/previous page. Not doubting, but are you sure? It doesn’t for non-CAN switches. How does the ADU know if the engine is running or not?
Yes, pretty sure - see the screenshot with analog switch voltage, the f_btn_* functions, and the rpm. I can get the mode button to work, but that’s because I can pick up the resulting ECU mode from another CAN input (WORKMODE_ACTIVE). @Matthias_avp posts are more on-the-money for you.
As for why the ADU needs the engine to run, beats me. I have sent the info to tech support but Maciej is busy with high priority requests so it’ll take him some time before he can get back to me. Maybe it’s just a matter of a default configuration option that I’m not aware of.
I checked your project, and since the symptoms you described sound impossible, I looked deeper - and indeed, you have an incorrect configuration of the page up/down buttons. Change the trigger to “press” instead of “click”.
According to the manual:
“Click – function activated by quickly pressing and releasing a button”
Based on the log you sent me via email: both the down/up events that didn’t trigger the page change were longer than 500ms - this is the threshold for triggering the button in Click mode. Every single button up event that triggered the page change was shorter than this threshold - those clicks were quick. It works as expected.
500ms okay, that’s far longer than I would have expected for a quick press. Definitely changing them tonight.
The ECU can detect far quicker presses - as I recall the standard setup in the ECU says 25ms for adjusting the traction control factor up/down via the buttons. Long presses (e.g. 2-5 seconds) are used for zeroing the suspension pots.
Hi.
Would you be willing to share your project file? I’m tinkering with an ADU and a rotary switch myself and can’t get it to work. I’ve tried the suggestions that have been posted here.