Skip to content

Commit

Permalink
fix dac off problem
Browse files Browse the repository at this point in the history
  • Loading branch information
profezzorn committed Dec 12, 2021
1 parent 0c81da4 commit 31b98d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ProffieOS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ class Commands : public CommandParser {
if (e && atoi(e) != i) continue;
wav_players[i].dump();
}
return true;
}
#endif // ENABLE_DEVELOPER_COMMANDS
#endif
Expand Down
5 changes: 4 additions & 1 deletion sound/amplifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Amplifier : Looper, StateMachine, CommandParser {
sgtl5000_enabled = true;
}
#else
if (!digitalRead(amplifierPin)) {
if (!on_) {
EnableBooster();
pinMode(amplifierPin, OUTPUT);
digitalWrite(amplifierPin, HIGH);
Expand All @@ -68,6 +68,7 @@ class Amplifier : Looper, StateMachine, CommandParser {
SLEEP(20);
if (Active()) continue;
STDOUT.println("Amplifier off.");
on_ = false;
// digitalWrite(amplifierPin, LOW); // turn the amplifier off
#ifdef AUDIO_CONTROL_SGTL5000
// Disable does nothing, so this is pointless.
Expand All @@ -78,6 +79,7 @@ class Amplifier : Looper, StateMachine, CommandParser {
pinMode(amplifierPin, INPUT_ANALOG); // Let the pull-down do the work
#endif
SLEEP(20);
if (on_) continue;
dac.end();
while (!Active()) YIELD();
}
Expand Down Expand Up @@ -132,6 +134,7 @@ class Amplifier : Looper, StateMachine, CommandParser {
}

private:
bool on_ = false;
uint32_t last_enabled_;
};

Expand Down

0 comments on commit 31b98d0

Please sign in to comment.