You are here

Lisp script detaches both ADC

2 posts / 0 new
Last post
dannydnl
Offline
Last seen: 1 month 5 days ago
VESC Free
Joined: 2023-08-31 18:52
Posts: 3
Lisp script detaches both ADC

Hello everyone,

I have an issue using a lisp script that detaches both ADC1 and ADC2, even though i set only to detach ADC1.

The part where this happens is below:

(defun set-assist (assist1)
  (progn
    (define assist (if assist1 1 0))
    (if assist1
      (app-adc-detach 1 0) ; engage throttle current, attach ADC1 to enable the motor
      (progn ; else
        (define assist_cnt 0)
        (app-adc-detach 1 2) ; detach ADC1 to disable the motor
      )
    )
  )
)

(app-adc-detach 1 2) should only detach ADC1, but that it's not happening.

After i stop pedaling the brake doesn't respond to anything.

If i pedal and then brake at the same time, it work fine, until i stop pedaling.

Looking in Vesc tool, the ADC2 value doesn't change if i engage it.

Again, ADC2 reading works fine without the script uploaded, so it's not a wiring problem

 

Is this a bug, or am i doing something stupid?

dannydnl
Offline
Last seen: 1 month 5 days ago
VESC Free
Joined: 2023-08-31 18:52
Posts: 3

Update:

I found that 6.0.2 fw doesn't support detaching 2 separate ADC's

I flashed 6.0.5 fw but it still doesn't work, but some things changed.

Now, when i look in vesc tool if i set (app-adc-detach 1 2), ADC1 is detached and ADC2 is not.

When i engage the brakes i see the voltage changing in the adc app but the braking doesn't work at all.

When using (app-adc-detach 1 0) the brake works fine then.

So there is still a problem with brake detach.

Can someone help with this?