lknds
Dependencies: mbed TrapezoidControl Pulse QEI
Diff: System/Process/Process.cpp
- Revision:
- 17:50dc4b449e69
- Parent:
- 16:3f2c2d89372b
- Child:
- 18:c694bae76e51
--- a/System/Process/Process.cpp Mon Jul 01 13:00:20 2019 +0000 +++ b/System/Process/Process.cpp Sat Jul 06 07:58:17 2019 +0000 @@ -52,7 +52,6 @@ Ticker BuzzerTimer; bool EMGflag = false; PwmOut buzzer(BUZZER_PIN); -//buzzer.period(1.0/800); //**************Buzzer**************** //************TapeLed***************** @@ -187,6 +186,7 @@ //LED_DEBUG0 = !LED_DEBUG0; //LED_DEBUG1 = !LED_DEBUG1; //printf("%d\r\n",ECD_0.getPulses()); + buzzer.period(1.0/800); #ifdef USE_MU controller = CONTROLLER::Controller::GetData(); @@ -198,8 +198,11 @@ CONTROLLER::Controller::DataReset(); AllActuatorReset(); lock = true; - buzzer = 1; - BuzzerTimer.attach(BuzzerTimer_func, 0.5); + //buzzer = 1; + //BuzzerTimer.attach(BuzzerTimer_func, 0.5); + //buzzer = 1; + //BuzzerTimer.attach(&BuzzerTimer_func, 1.2); + //BuzzerTimer.attach(BuzzerTimer_func, 1); } else #endif @@ -218,18 +221,17 @@ } //Emergency! - if(EMG_0 || EMG_1){ - buzzer = 1; - BuzzerTimer.attach(BuzzerTimer_func, 1.2); - current = 0; + if(!EMG_0 && !EMG_1 && !EMGflag){ + buzzer = 0; + BuzzerTimer.attach(BuzzerTimer_func, 1); + EMGflag = true; + LED_DEBUG0 = 1; } - - //Safety - if(!EMG_0 && !EMG_1){ - buzzer = 0; + if(EMG_0 && EMG_1 && EMGflag){ + buzzer = 1; BuzzerTimer.detach(); + EMGflag = false; } - SystemProcessUpdate(); } } @@ -329,6 +331,7 @@ void BuzzerTimer_func(){ buzzer = !buzzer; + //LED_DEBUG0 = !LED_DEBUG0; } void TapeLedEms_func() {