Skip to content

Commit

Permalink
fix IR power scaling (commaai#34293)
Browse files Browse the repository at this point in the history
* fix IR power scaling

* Update system/hardware/tici/hardware.h
  • Loading branch information
adeebshihadeh authored Dec 20, 2024
1 parent 0265f20 commit ce4ebbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system/hardware/tici/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@ class HardwareTici : public HardwareNone {
return;
}

percent = std::clamp(percent, 0, 100);
int value = util::map_val(std::clamp(percent, 0, 100), 0, 100, 0, 255);

std::ofstream torch_brightness("/sys/class/leds/led:torch_2/brightness");
if (torch_brightness.is_open()) {
torch_brightness << percent << "\n";
torch_brightness << value << "\n";
torch_brightness.close();
}

std::ofstream switch_brightness("/sys/class/leds/led:switch_2/brightness");
if (switch_brightness.is_open()) {
switch_brightness << percent << "\n";
switch_brightness << value << "\n";
switch_brightness.close();
}
}
Expand Down

0 comments on commit ce4ebbd

Please sign in to comment.