Skip to content

Commit efe0c25

Browse files
committed
Address review comments
1 parent 78abf96 commit efe0c25

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

flight_computer/src/config/globals.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ extern event_action_map_elem_t* event_action_map;
7878
inline constexpr const char* board_name = "CATS Vega";
7979
extern char telemetry_code_version[20];
8080

81-
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
81+
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)

flight_computer/src/drivers/buzzer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ namespace driver {
2222

2323
void Buzzer::SetVolume(uint16_t volume) {
2424
const uint16_t pwm_depth = m_pwm_channel.GetPwmDepth();
25+
// Limit volume to 100%
26+
volume = std::min<uint16_t>(100U, volume);
2527
// 100% volume = 50% pwm
26-
// NOLINTNEXTLINE(bugprone-implicit-widening-of-multiplication-result)
27-
const uint32_t pwm_ticks = (pwm_depth / 200U) * volume;
28+
const uint32_t pwm_ticks = (static_cast<uint32_t>(pwm_depth) / 200U) * volume;
2829
m_pwm_channel.SetDutyCycleTicks(pwm_ticks);
2930
}
3031

0 commit comments

Comments
 (0)