Skip to content

Commit

Permalink
lv debugging - works as expected in this commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeFreer committed Jul 16, 2024
1 parent b831704 commit 880e149
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
9 changes: 1 addition & 8 deletions firmware/projects/LVController/inc/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ class Subsystem {
: enable_output_(enable_output) {}

inline virtual void Enable() const {
bindings::DelayMS(1000);
bindings::DelayMS(10000);

return; // disable gpio
enable_output_.SetHigh();
}

inline virtual void Disable() const {
return; // disable gpio
enable_output_.SetLow();
}

Expand All @@ -63,17 +61,14 @@ class Indicator {
Indicator(shared::periph::DigitalOutput& output) : output_(output) {}

inline void TurnOn() {
return; // dsiable gpio
output_.SetHigh();
}

inline void TurnOff() {
return; // dsiable gpio
output_.SetLow();
}

inline void SetState(bool value) {
return; // dsiable gpio
output_.Set(value);
}

Expand Down Expand Up @@ -146,7 +141,6 @@ class Fan : public Subsystem {
float duty_per_second_ = 0.0f;

void SetPower(float power) const {
return; // disable gpio
pwm_output_.SetDutyCycle(power_to_duty_.Evaluate(power));
}
};
Expand All @@ -161,7 +155,6 @@ class DCDC : public Subsystem {
led_(led_output){};

bool CheckValid() {
return false; // disable gpio
bool is_valid = valid_input_.Read();
led_.SetState(is_valid);
return is_valid;
Expand Down
15 changes: 11 additions & 4 deletions firmware/projects/LVController/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ Subsystem imu_gps{bindings::imu_gps_en};
Subsystem shutdown_circuit{bindings::shutdown_circuit_en};
Subsystem inverter{bindings::inverter_switch_en};

auto dcdc_en_inverted =
shared::periph::InvertedDigitalOutput(bindings::dcdc_en);

DCDC dcdc{
bindings::dcdc_en,
dcdc_en_inverted,
bindings::dcdc_valid,
bindings::dcdc_led_en,
};
Expand Down Expand Up @@ -65,7 +68,7 @@ void DoPowerupSequence() {

bindings::DelayMS(50);

raspberry_pi.Enable();
// raspberry_pi.Enable();
state_tx.UpdateState(LvControllerState::RaspiEnabled);

bindings::DelayMS(50);
Expand All @@ -75,7 +78,7 @@ void DoPowerupSequence() {

bindings::DelayMS(100);

speedgoat.Enable();
// speedgoat.Enable();
state_tx.UpdateState(LvControllerState::SpeedgoatEnabled);

bindings::DelayMS(100);
Expand All @@ -95,7 +98,7 @@ void DoPowerupSequence() {

bindings::DelayMS(50);

imu_gps.Enable();
// imu_gps.Enable();
state_tx.UpdateState(LvControllerState::ImuGpsEnabled);
}

Expand Down Expand Up @@ -177,6 +180,8 @@ void DoInverterSwitchCheck() {
int main(void) {
bindings::Initialize();

bindings::DelayMS(10000); // initial

state_tx.UpdateState(LvControllerState::Startup);

// Ensure all subsystems are disabled to start.
Expand All @@ -187,6 +192,8 @@ int main(void) {
// Powerup sequence
DoPowerupSequence();

while (true) continue; // stop after fc enable debug

do {
state_tx.UpdateState(LvControllerState::WaitingForOpenContactors);
bindings::DelayMS(50);
Expand Down

0 comments on commit 880e149

Please sign in to comment.