Skip to content

Commit

Permalink
Added current sensing
Browse files Browse the repository at this point in the history
  • Loading branch information
gsbfy2 committed Apr 26, 2022
2 parents 6ad5473 + 3641ba1 commit 44f6e10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion powerboardcode/powerboard/powerboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ uint8_t twelveLogicOverCurrent = 0;
#define MOTOR6_CTL 30
#define MOTORS_CTL 36

#define MOTOR_DELAY 750
#define MOTOR_DELAY 500

//uint8_t currentSense12V[] = {MULTIMEDIA_SENSE, NAV_SENSE, GIMBAL_ACT_SENSE, DRIVE_SENSE, SCISENSOR_ACT_SENSE, NETSWITCH_SENSE, CAM1_SENSE, CAM2_SENSE, BBB_SENSE, AUX_LOG_SENSE};
uint8_t twelveVoltBusses[NUM_12V_PORTS] = {GIMBAL_CTL, DRIVE_CTL, MULTIMEDIA_CTL, NAV_CTL, CAM1_CTL, CAM2_CTL, BBB_CTL, SPARE_CTL};
Expand Down
16 changes: 7 additions & 9 deletions powerboardcode/powerboard/powerboard.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
void setup()
{
Serial.begin(115200);
Telemetry.begin(telemetry, 1500000);
setPins();
setPinStates();
Serial.begin(115200);
RoveComm.begin(RC_POWERBOARD_FOURTHOCTET, &TCPServer, RC_ROVECOMM_POWERBOARD_MAC);
Telemetry.begin(telemetry, 1500000);
}

void loop()
Expand Down Expand Up @@ -88,16 +87,15 @@ void loop()

void setPins()
{
// sets Spare to OUTPUT
pinMode(PACK_SPARE_CTL, OUTPUT);
pinMode(POE_CTL, OUTPUT);

// sets motor busses to OUTPUT
for (int i = 0 ; i < NUM_MOTORS ; i++)
{
pinMode(motorBusses[i], OUTPUT);
digitalWrite(motorBusses[i], LOW);
}

pinMode(PACK_SPARE_CTL, OUTPUT);
pinMode(POE_CTL, OUTPUT);
// sets Aux to OUTPUT
pinMode(AUX_CTL, OUTPUT);

Expand All @@ -110,8 +108,6 @@ void setPins()

void setPinStates()
{
digitalWrite(POE_CTL, HIGH);
digitalWrite(PACK_SPARE_CTL, HIGH);
// turns on 12 volt busses
for (int i = 0 ; i < NUM_12V_PORTS ; i++)
{
Expand All @@ -127,6 +123,9 @@ void setPinStates()
delay(MOTOR_DELAY);
digitalWrite(motorBusses[i], HIGH);
}
digitalWrite(PACK_SPARE_CTL, HIGH);
digitalWrite(POE_CTL, HIGH);

}

float senseCurrent(const uint8_t sensePin)
Expand Down Expand Up @@ -212,5 +211,4 @@ void telemetry()
delay(100);
RoveComm.write(RC_POWERBOARD_TWELVEVLOGICBUSCURRENT_DATA_ID, RC_POWERBOARD_TWELVEVLOGICBUSCURRENT_DATA_COUNT, TWELVELOGICBUSCURRENTS);
delay(100);
Telemetry.begin(telemetry, 1500000);
}

0 comments on commit 44f6e10

Please sign in to comment.