|
|
|
@ -13,7 +13,7 @@ |
|
|
|
#include "lib/dict.h" |
|
|
|
#include "lib/dict.h" |
|
|
|
#include "splitflap_flaps.h" |
|
|
|
#include "splitflap_flaps.h" |
|
|
|
|
|
|
|
|
|
|
|
dict_t **splitFlapDict; |
|
|
|
static dict_t **splitFlapDict; |
|
|
|
|
|
|
|
|
|
|
|
void SF_InitConfig(void){ |
|
|
|
void SF_InitConfig(void){ |
|
|
|
splitFlapDict = dictAlloc(); |
|
|
|
splitFlapDict = dictAlloc(); |
|
|
|
@ -144,7 +144,8 @@ void SF_MoveToFlap(SF_Handle_t instance, char* flap){ |
|
|
|
int32_t currentPos = McuULN2003_GetPos(((SF_t*)instance)->motor); |
|
|
|
int32_t currentPos = McuULN2003_GetPos(((SF_t*)instance)->motor); |
|
|
|
// calc steps to move
|
|
|
|
// calc steps to move
|
|
|
|
int32_t stepsToReachFlap = 0; |
|
|
|
int32_t stepsToReachFlap = 0; |
|
|
|
if(flapPos == currentPos){ |
|
|
|
// not already there
|
|
|
|
|
|
|
|
if(flapPos != currentPos){ |
|
|
|
if(flapPos < currentPos){ |
|
|
|
if(flapPos < currentPos){ |
|
|
|
stepsToReachFlap = SPLITFLAP_STEPS_ONE_ROUND-currentPos+flapPos; |
|
|
|
stepsToReachFlap = SPLITFLAP_STEPS_ONE_ROUND-currentPos+flapPos; |
|
|
|
}else if(flapPos > currentPos){ |
|
|
|
}else if(flapPos > currentPos){ |
|
|
|
@ -155,6 +156,10 @@ void SF_MoveToFlap(SF_Handle_t instance, char* flap){ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int32_t SF_GetMotorPosition(SF_Handle_t instance){ |
|
|
|
|
|
|
|
return McuULN2003_GetPos(((SF_t*)instance)->motor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SF_Deinit(SF_Handle_t instance){ |
|
|
|
void SF_Deinit(SF_Handle_t instance){ |
|
|
|
McuULN2003_DeinitMotor(((SF_t*)instance)->motor); |
|
|
|
McuULN2003_DeinitMotor(((SF_t*)instance)->motor); |
|
|
|
McuGPIO_DeinitGPIO(((SF_t*)instance)->magSensor); |
|
|
|
McuGPIO_DeinitGPIO(((SF_t*)instance)->magSensor); |
|
|
|
|