Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 13, 2025
1 parent a760262 commit 0cadd6d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Marlin/src/HAL/TEENSY40_41/fast_pwm.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2024 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
* Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
Expand Down Expand Up @@ -29,12 +29,9 @@
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size /*=255*/, const bool invert) {

uint32_t bits = 1;
uint16_t value = v;
uint16_t value = _MIN(v, v_size);

if (v > v_size) {
value = v_size;
}
value = invert ? v_size - value : value;
if (invert) value = v_size - value;

// Choose scale as smallest power of 2 which holds v_size.
uint32_t scale = 1;
Expand Down

0 comments on commit 0cadd6d

Please sign in to comment.