News for hackers. Stuff that matters.
Re:Show HN: C++ library for reading MacBook lid angle sensor... by tos1 on Monday September 08, 2025 @03:53AM (#45165655)
Cool! I'm wondering why is the lid-opening angle a 16 bit value without any scaling? Can MacBooks be opened > 255°? :)

(https://github.com/ufoym/mac-angle/blob/main/angle.cpp#L186)

Re:Show HN: C++ library for reading MacBook lid angle sensor... by GranPC on Monday September 08, 2025 @05:02AM (#45166095)
Technically yes - might have a bit of a hard time closing it back down tho.
Re:Show HN: C++ library for reading MacBook lid angle sensor... by chippiewill on Monday September 08, 2025 @07:08AM (#45166871)
It's a low level library, it's probably just the register on the sensor itself is 16bit so that's what gets propagated up to the OS.

The most I can reach on mine is 132deg

Re:Show HN: C++ library for reading MacBook lid angle sensor... by mort96 on Monday September 08, 2025 @07:32AM (#45167020)
The underlying system API is a u16. Do you propose that this library should add logic to clamp the value between 0 and 255? What would be the point in that?
Re:Show HN: C++ library for reading MacBook lid angle sensor... by bboygravity on Monday September 08, 2025 @08:24AM (#45167420)
To save 1 byte in RAM for the 300MB electron app that will load this lib.