Skip to content

Commit

Permalink
E09 ERROR_MOTOR_CHECK fix
Browse files Browse the repository at this point in the history
  • Loading branch information
emmebrusa committed Jul 27, 2024
1 parent ad782fd commit b8e1be9
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/ebike_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,34 +1658,32 @@ static void check_system(void)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// E09 ERROR_MOTOR_CHECK (E08 blinking for XH18)
// E09 shared with ERROR_WRITE_EEPROM
#define MOTOR_CHECK_TIME_GOES_ALONE_TRESHOLD 80 // 80 * 100ms = 8.0 seconds
#define MOTOR_CHECK_TIME_GOES_ALONE_TRESHOLD 60 // 60 * 100ms = 6.0 seconds
#define MOTOR_CHECK_ERPS_THRESHOLD 20 // 20 ERPS
static uint8_t ui8_riding_torque_mode = 0;
static uint8_t ui8_motor_check_time_goes_alone = 0;
static uint8_t ui8_motor_check_goes_alone_timer = 0U;

// riding modes that use the torque sensor
if (((m_configuration_variables.ui8_riding_mode == POWER_ASSIST_MODE)
||(m_configuration_variables.ui8_riding_mode == TORQUE_ASSIST_MODE)
||(m_configuration_variables.ui8_riding_mode == HYBRID_ASSIST_MODE)
||(m_configuration_variables.ui8_riding_mode == eMTB_ASSIST_MODE))
&& (!ui8_adc_throttle_assist)) {
ui8_riding_torque_mode = 1;
&& (ui8_adc_throttle_assist == 0U)) {
ui8_riding_torque_mode = 1;
}
else {
ui8_riding_torque_mode = 0;
}
// Check if the motor goes alone and with current or duty cycle target = 0 (safety)
if ((ui16_motor_speed_erps > MOTOR_CHECK_ERPS_THRESHOLD)
&&((ui8_riding_torque_mode)
||(m_configuration_variables.ui8_riding_mode == CADENCE_ASSIST_MODE))){
if ((!ui8_adc_battery_current_target || !ui8_duty_cycle_target)) {
ui8_motor_check_time_goes_alone++;
}
&&((ui8_riding_torque_mode) || (m_configuration_variables.ui8_riding_mode == CADENCE_ASSIST_MODE))
&& (ui8_adc_battery_current_target == 0U || ui8_duty_cycle_target == 0U)) {
ui8_motor_check_goes_alone_timer++;
}
else {
ui8_motor_check_time_goes_alone = 0;
ui8_motor_check_goes_alone_timer = 0;
}
if (ui8_motor_check_time_goes_alone > MOTOR_CHECK_TIME_GOES_ALONE_TRESHOLD) {
if (ui8_motor_check_goes_alone_timer > MOTOR_CHECK_TIME_GOES_ALONE_TRESHOLD) {
ui8_system_state = ERROR_MOTOR_CHECK;
}

Expand Down Expand Up @@ -2977,6 +2975,7 @@ static void uart_send_package(void)
if ((ui8_display_fault_code != NO_FAULT)&&(ui8_display_function_code == NO_FUNCTION)) {
#if ENABLE_XH18
if (ui8_display_fault_code == ERROR_WRITE_EEPROM) {
// shared with ERROR_MOTOR_CHECK
// instead of E09, display blinking E08
if (ui8_default_flash_state) {
ui8_tx_buffer[5] = 8;
Expand Down

0 comments on commit b8e1be9

Please sign in to comment.