add start/stop when brake is engaged

master
Eggert Jung 3 years ago
parent c62792a864
commit 18d2ae2f3c

@ -152,6 +152,8 @@ void ioHelperEdgeDetector(void);
#define BTN_KRAFT_MINUS BitPinG2
#define IN_TAENZER_HOME BitPinF0
#define IN_SPULE_HOME BitPinF1
#define IN_SPULE_HOME BitPinF1
#define IN_BREMSE_STATE BitPinF2
#endif

@ -80,7 +80,7 @@ void do_spule(){
}
// manual forwarding if button is held
else if(!get_abzug_state()){
else if(!get_abzug_state() || (get_abzug_state() && read_Input(IN_BREMSE_STATE, LEVEL)) ){
if(read_Input(BTN_WICKELN_EIN, LEVEL)){
set_spooling_speed(300);
spule_onoff(1);
@ -122,7 +122,7 @@ void do_spule(){
ICR1 = ICR5/TRANS_ROT_FACTOR;
OCR1A = ICR1/2;
if (read_Input(BTN_WICKELN_EIN, RISING)) {
if (read_Input(BTN_WICKELN_EIN, RISING) && !read_Input(IN_BREMSE_STATE, LEVEL)) {
spule_onoff(1);
}
if (read_Input(BTN_WICKELN_AUS, RISING)) {
@ -136,6 +136,17 @@ void do_spule(){
windings = 0;
windings_wakeup = 0;
}
if (read_Input(IN_BREMSE_STATE, FALLING)) {
printf("draußen\n");
spule_onoff(1);
}
if (read_Input(IN_BREMSE_STATE, RISING)) {
printf("drinne\n");
spule_onoff(0);
}
//PORTH |= (1<<5);
}