Skip to content

Commit

Permalink
Updated Controllers to Reflect PinMap Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TekuConcept committed Mar 24, 2017
1 parent 9cbbbb1 commit 7cc6bb3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions ArduinoController/ArduinoController.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ void setup() {
[](){((KillSwitchController*)controllers[0])->isr(KILLSWITCH_PIN);},
CHANGE
);
controllers[1] = new ThrustController(MOVE_PIN);
controllers[2] = new ThrustController(STRAFE_PIN);
controllers[3] = new ThrustController(DIVE_PIN);
controllers[4] = new ThrustController(YAW_PIN);
controllers[5] = new ThrustController(PITCH_PIN);
controllers[6] = new ThrustController(ROLL_PIN);
controllers[1] = new ThrustController(PWM::MOVE_PIN);
controllers[2] = new ThrustController(PWM::STRAFE_PIN);
controllers[3] = new ThrustController(PWM::DIVE_PIN);
controllers[4] = new ThrustController(PWM::YAW_PIN);
controllers[5] = new ThrustController(PWM::PITCH_PIN);
controllers[6] = new ThrustController(PWM::ROLL_PIN);
controllers[7] = new EscController();
controllers[8] = new LedController();
controllers[9] = new PingController();
Expand Down
12 changes: 6 additions & 6 deletions ArduinoController/EscController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ class EscController : public IController {

private:
uint8_t GPIO_PINS[GPIO_CNT] = {
ESC_S1_PIN,
ESC_S2_PIN,
ESC_S3_PIN,
ESC_S4_PIN,
ESC_S5_PIN,
ESC_S6_PIN
GPIO::ESC_S1_PIN,
GPIO::ESC_S2_PIN,
GPIO::ESC_S3_PIN,
GPIO::ESC_S4_PIN,
GPIO::ESC_S5_PIN,
GPIO::ESC_S6_PIN
};
public:
EscController() {
Expand Down
4 changes: 2 additions & 2 deletions ArduinoController/KillSwitchController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class KillSwitchController : public IController {
KillSwitchController(IController ** _list_, int _count_) {
list = _list_;
count = _count_;
pinMode(LED_STAT_PIN, OUTPUT);
pinMode(GPIO::LED_STAT_PIN, OUTPUT);
}

void execute() {
Expand All @@ -31,7 +31,7 @@ class KillSwitchController : public IController {
active = !digitalRead(interrupt);
if(active)
kill();
digitalWrite(LED_STAT_PIN, active);
digitalWrite(GPIO::LED_STAT_PIN, active);
interrupts();
}
};
10 changes: 5 additions & 5 deletions ArduinoController/LedController.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ class LedController : public IController {
private:
public:
LedController() {
pinMode(LED_CTRL_PIN, OUTPUT);
digitalWrite(LED_CTRL_PIN, LOW);
pinMode(GPIO::LED_CTRL_PIN, OUTPUT);
digitalWrite(GPIO::LED_CTRL_PIN, LOW);
}
void execute() {
for(int i = 0; i < 2; i++) {
digitalWrite(LED_CTRL_PIN, HIGH);
digitalWrite(GPIO::LED_CTRL_PIN, HIGH);
delay(250);
digitalWrite(LED_CTRL_PIN, LOW);
digitalWrite(GPIO::LED_CTRL_PIN, LOW);
delay(250);
}
}
void kill() {
digitalWrite(LED_CTRL_PIN, LOW);
digitalWrite(GPIO::LED_CTRL_PIN, LOW);
}
};
6 changes: 3 additions & 3 deletions ArduinoController/LightController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
class LightController : public IController {
public:
LightController() {
pinMode(LIGHTS_PIN, OUTPUT);
digitalWrite(LIGHTS_PIN, HIGH);
pinMode(GPIO::LIGHTS_PIN, OUTPUT);
digitalWrite(GPIO::LIGHTS_PIN, HIGH);
}
void execute() {
digitalWrite(LIGHTS_PIN, !SerialTools::readByte());
digitalWrite(GPIO::LIGHTS_PIN, !SerialTools::readByte());
}
void kill() { }
};
2 changes: 1 addition & 1 deletion ArduinoController/ThrustController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ThrustController : public IController {
const uint16_t REVERSE = 1000;
Servo servo_;
public:
ThrustController(uint8_t servoPin) {
ThrustController(PWM servoPin) {
servo_.attach(servoPin);
servo_.writeMicroseconds(IDLE);
}
Expand Down
4 changes: 2 additions & 2 deletions ArduinoController/VoltageController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class VoltageController : public IController {
const double R2 = 7500.0;
public:
VoltageController() {
pinMode(VOLT_PIN, INPUT);
pinMode(GPIO::VOLT_PIN, INPUT);
}

void execute() {
int value = analogRead(VOLT_PIN);
int value = analogRead(GPIO::VOLT_PIN);
/*
* Measured Values for Calibration
* P1 = (11.32, 700); P2 = (8.38, 517)
Expand Down

0 comments on commit 7cc6bb3

Please sign in to comment.