Don't reset count if we've already found the index...

This commit is contained in:
Paul Guenette
2017-12-14 22:08:43 -05:00
parent 7dd7ce2afc
commit 67cac6463d
+6 -4
View File
@@ -530,12 +530,14 @@ void step_cb(uint16_t GPIO_Pin) {
}
}
void enc_index_cb(uint16_t GPIO_Pin, int index){
setEncoderCount(&motors[index], 0);
motors[index].IndexFound = true;
// Triggered when an encoder passes over the "Index" pin
void enc_index_cb(uint16_t GPIO_Pin, int index) {
if (!motors[index].encoder.index_found) {
setEncoderCount(&motors[index], 0);
motors[index].encoder.index_found = true;
}
}
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc, bool injected) {
static const float voltage_scale = 3.3f * 11.0f / (float)(1 << 12);
// Only one conversion in sequence, so only rank1