diff --git a/lambda-test/airgate-test.c b/lambda-test/airgate-test.c index db4f9b9..3e92ffb 100644 --- a/lambda-test/airgate-test.c +++ b/lambda-test/airgate-test.c @@ -125,19 +125,6 @@ return true; } -static bool testRememberAirgate(void) { - - resetAirgate(0); - setAirgate(100); - - resetAirgate(0); - initAirgate(); - - assertTrue(100 == getAirgate()); - - return true; -} - /* Test "class" */ static const char class[] PROGMEM = "airgate"; @@ -146,15 +133,13 @@ static const char testMakeSteps_P[] PROGMEM = "testMakeSteps"; static const char testSetSleepMode_P[] PROGMEM = "testSetSleepMode"; static const char testIsDriverFault_P[] PROGMEM = "testIsDriverFault"; -static const char testRememberAirgate_P[] PROGMEM = "testRememberAirgate"; /* Tests */ static TestCase const tests[] = { {class, testSetAirgate_P, testSetAirgate}, {class, testMakeSteps_P, testMakeSteps}, {class, testSetSleepMode_P, testSetSleepMode}, - {class, testIsDriverFault_P, testIsDriverFault}, - {class, testRememberAirgate_P, testRememberAirgate} + {class, testIsDriverFault_P, testIsDriverFault} }; TestClass airgateClass = {tests, ARRAY_LENGTH(tests)}; diff --git a/lambda/airgate.c b/lambda/airgate.c index b32d482..489391d 100644 --- a/lambda/airgate.c +++ b/lambda/airgate.c @@ -15,7 +15,6 @@ #include #include #include "airgate.h" -#include "eeprom.h" #include "integers.h" #include "interrupts.h" #include "pins.h" @@ -23,7 +22,7 @@ /* Direction */ static volatile int8_t dir = 0; /* Current position */ -static volatile uint16_t pos = 0; +static volatile int16_t pos = 0; /* Steps remaining */ static volatile uint16_t steps = 0; /* Steps done */ @@ -92,11 +91,6 @@ } } -void initAirgate(void) { - uint16_t val = eeprom_read_byte(ADDR_AIRGATE_POS); - pos = (val << STEPPING_MODE); -} - void setAirgate(uint8_t const target) { if (target == getAirgate() || isAirgateBusy() || isDriverFault()) { return; @@ -108,7 +102,6 @@ steps = abs(diff); ramp = MIN(abs(MAX_SPEED - MIN_SPEED), steps >> 1); start(); - eeprom_update_byte(ADDR_AIRGATE_POS, target); } } @@ -139,9 +132,9 @@ } } -void resetAirgate(uint16_t const position) { +void resetAirgate(uint8_t const position) { dir = 0; - pos = position << STEPPING_MODE; + pos = ((int16_t)position) << STEPPING_MODE; steps = 0; done = 0; ramp = 0; diff --git a/lambda/airgate.h b/lambda/airgate.h index 7bcb4a1..4e1e9a7 100644 --- a/lambda/airgate.h +++ b/lambda/airgate.h @@ -39,11 +39,6 @@ void makeSteps(void); /** - * Gets the airgate position stored in EEPROM. - */ -void initAirgate(void); - -/** * Sets the airgate position 0 - 255, where 200 units correspond to 360° * rotation (with 1.8° step angle). Stores the position in EEPROM. */ @@ -74,6 +69,6 @@ /** * Resets to initial state and the given position. For unit tests. */ -void resetAirgate(uint16_t const position); +void resetAirgate(uint8_t const position); #endif /* AIRGATE_H_ */ diff --git a/lambda/eeprom.h b/lambda/eeprom.h deleted file mode 100644 index 1c29242..0000000 --- a/lambda/eeprom.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * eeprom.h - * - * Created on: 02.04.2016 - * Author: dode@luniks.net - */ - -#ifndef EEPROM_H_ -#define EEPROM_H_ - -#define ADDR_AIRGATE_POS (uint8_t *)0 - -#endif /* EEPROM_H_ */ diff --git a/lambda/lambda.c b/lambda/lambda.c index 4d9610a..5c4005f 100644 --- a/lambda/lambda.c +++ b/lambda/lambda.c @@ -55,7 +55,6 @@ setupSleepMode(); initInterrupts(); initTimers(); - initAirgate(); // wake up stepper motor driver setSleepMode(false);