mirror of https://github.com/rusefi/bldc.git
Lispbm offDelay current argument
This commit is contained in:
parent
766f6e02d4
commit
360f0ef9a9
|
@ -32,7 +32,7 @@ void comm_can_set_baud(CAN_BAUD baud);
|
|||
void comm_can_transmit_eid(uint32_t id, const uint8_t *data, uint8_t len);
|
||||
void comm_can_transmit_eid_if(uint32_t id, const uint8_t *data, uint8_t len, int interface);
|
||||
void comm_can_transmit_eid_replace(uint32_t id, const uint8_t *data, uint8_t len, bool replace, int interface);
|
||||
void comm_can_transmit_sid(uint32_t id, uint8_t *data, uint8_t len);
|
||||
void comm_can_transmit_sid(uint32_t id, const uint8_t *data, uint8_t len);
|
||||
void comm_can_set_sid_rx_callback(bool (*p_func)(uint32_t id, uint8_t *data, uint8_t len));
|
||||
void comm_can_set_eid_rx_callback(bool (*p_func)(uint32_t id, uint8_t *data, uint8_t len));
|
||||
void comm_can_send_buffer(uint8_t controller_id, uint8_t *data, unsigned int len, uint8_t send);
|
||||
|
|
|
@ -319,19 +319,23 @@ Sets the override value
|
|||
#### set-current
|
||||
|
||||
```clj
|
||||
(set-current current)
|
||||
(set-current current optOffDelay)
|
||||
```
|
||||
|
||||
Set motor current in amperes.
|
||||
|
||||
The optional optOffDelay argument (in seconds) will delay turning off the modulation when setting 0 current. This is useful when running e.g. a control loop that will end up setting 0 current in some circumstances when turning off the modulation would make the control less smooth. The delay value should be longer than the rate at which the control loop runs.
|
||||
|
||||
#### set-current-rel
|
||||
|
||||
```clj
|
||||
(set-current-rel current)
|
||||
(set-current-rel current optOffDelay)
|
||||
```
|
||||
|
||||
Set motor current relative to the maximum current. Range -1 to 1. For example, if the maximum current is set to 50A, (set-current-rel 0.5) will set the current to 25A.
|
||||
|
||||
See [set-current](#set-current) for details on what the optional argument optOffDelay does.
|
||||
|
||||
#### set-duty
|
||||
```clj
|
||||
(set-duty dutycycle)
|
||||
|
@ -480,7 +484,7 @@ Notice that all canget-commands rely on the status messages being active on the
|
|||
|
||||
#### canset-current
|
||||
```clj
|
||||
(canset-current id current)
|
||||
(canset-current id current optOffDelay)
|
||||
```
|
||||
|
||||
Set current over CAN-bus on VESC with id. Example for setting 25A on VESC with id 115:
|
||||
|
@ -489,13 +493,17 @@ Set current over CAN-bus on VESC with id. Example for setting 25A on VESC with i
|
|||
(canset-current 115 25)
|
||||
```
|
||||
|
||||
See [set-current](#set-current) for details on what the optional argument optOffDelay does.
|
||||
|
||||
#### canset-current-rel
|
||||
```clj
|
||||
(canset-current-rel id current)
|
||||
(canset-current-rel id current optOffDelay)
|
||||
```
|
||||
|
||||
Same as above, but relative current in the range -1.0 to 1.0. See (set-current) for details on what relative current means.
|
||||
|
||||
See [set-current](#set-current) for details on what the optional argument optOffDelay does.
|
||||
|
||||
#### canset-duty
|
||||
```clj
|
||||
(canset-duty id duty)
|
||||
|
|
|
@ -987,16 +987,32 @@ static lbm_value ext_app_adc_override(lbm_value *args, lbm_uint argn) {
|
|||
// Motor set commands
|
||||
|
||||
static lbm_value ext_set_current(lbm_value *args, lbm_uint argn) {
|
||||
CHECK_ARGN_NUMBER(1);
|
||||
timeout_reset();
|
||||
mc_interface_set_current(lbm_dec_as_float(args[0]));
|
||||
CHECK_NUMBER_ALL();
|
||||
|
||||
if (argn == 1) {
|
||||
mc_interface_set_current(lbm_dec_as_float(args[0]));
|
||||
} else if (argn == 2) {
|
||||
mc_interface_set_current_off_delay(lbm_dec_as_float(args[1]));
|
||||
mc_interface_set_current(lbm_dec_as_float(args[0]));
|
||||
} else {
|
||||
return lbm_enc_sym(SYM_EERROR);
|
||||
}
|
||||
|
||||
return lbm_enc_sym(SYM_TRUE);
|
||||
}
|
||||
|
||||
static lbm_value ext_set_current_rel(lbm_value *args, lbm_uint argn) {
|
||||
CHECK_ARGN_NUMBER(1);
|
||||
timeout_reset();
|
||||
mc_interface_set_current_rel(lbm_dec_as_float(args[0]));
|
||||
CHECK_NUMBER_ALL();
|
||||
|
||||
if (argn == 1) {
|
||||
mc_interface_set_current_rel(lbm_dec_as_float(args[0]));
|
||||
} else if (argn == 2) {
|
||||
mc_interface_set_current_off_delay(lbm_dec_as_float(args[1]));
|
||||
mc_interface_set_current_rel(lbm_dec_as_float(args[0]));
|
||||
} else {
|
||||
return lbm_enc_sym(SYM_EERROR);
|
||||
}
|
||||
|
||||
return lbm_enc_sym(SYM_TRUE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue