Skip to content

Commit

Permalink
Code simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
markondej committed Dec 14, 2023
1 parent bb97176 commit d7fab76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions transmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ Transmitter::~Transmitter() {
cv.wait(lock, [&]() -> bool {
return !enable;
});
if (output != nullptr) {
if (output) {
delete output;
}
}
Expand All @@ -365,7 +365,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
}

auto finally = [&]() {
if (!preserveCarrier && (output != nullptr)) {
if (!preserveCarrier && output) {
delete output;
output = nullptr;
}
Expand All @@ -382,7 +382,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
unsigned clockDivisor = static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / frequency));
unsigned divisorRange = clockDivisor - static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / (frequency + 0.0005f * bandwidth)));

if (output == nullptr) {
if (!output) {
output = new ClockOutput(clockDivisor);
}

Expand Down

0 comments on commit d7fab76

Please sign in to comment.