Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: sm_esc.cpp
- Revision:
- 12:58ad06f9847d
- Parent:
- 9:1b54bac6d9a7
--- a/sm_esc.cpp Fri Oct 04 09:58:51 2019 +0000 +++ b/sm_esc.cpp Fri Oct 04 22:20:23 2019 +0000 @@ -1,5 +1,6 @@ #include "sm_esc.h" #include "sm_sections.h" +#include "sm_servo.h" PwmOut pwm_ESC(PD_12); DigitalOut relay_ESC(PG_0); @@ -42,7 +43,7 @@ switch(e_ESC_state) { case ESC_DISABLED: if(b_UTILS_flag_emergency_stop) { - rs_LOG_pc.printf("EMERGENCY STOP\r\n"); + rs_LOG.printf("EMERGENCY STOP\r\n"); b_UTILS_flag_emergency_stop = false; if(b_CHASSIS_with_pushbutton) { relay_ESC = 1; @@ -53,7 +54,7 @@ break; case ESC_INIT: - rs_LOG_pc.printf("Init esc\r\n"); + rs_LOG.printf("Init esc\r\n"); b_UTILS_flag_button_ESC = false; pwm_ESC.period_ms(ESC_PERIOD_DURATION_MS); //20 ms is default pwm_ESC.pulsewidth_us(0); @@ -71,13 +72,13 @@ wait(1); pwm_ESC.pulsewidth_us(ESC_PULSE_IDLE_US); wait(1); - log_start(10000); + log_start(120000); break; case ESC_COMMAND: switch(e_SECTIONS_state) { case RUNNING_SECTION: - pwm_ESC.pulsewidth_us(s_UTILS_currentSection->targetSpeed_mps); + pwm_ESC.pulsewidth_us(s_UTILS_currentSection->targetSpeed_mps - (d_SERVO_coefFreinage*s_UTILS_currentSection->plagePulseFreinage)); break; case STOPPED: break;