Open-Smartwatch / open-smartwatch-gps

Hardware design files for the GPS version of the open-smartwatch
GNU General Public License v3.0
198 stars 29 forks source link

Flashlight app? #8

Open Pescatore04 opened 3 years ago

Pescatore04 commented 3 years ago

I don't know how to code this and it goes against all the power saving efforts for such wearable. However, turning on all pixels white at low intensity might be a useful light source. IIRC, there is a fixed pull-up for the backlight, so adding a LED controller, or via PWM would provide a settable intensity.

BenjaminSchlechter commented 2 years ago

That's a great idea and to get started developing apps for the osw i decided to implement this.

For the intensity i set the default to max as the display isn't emitting as much light as a lamp - however for indoor usage at night i think it's good enough. I haven't digged into the hardware/PWM thing and just used the software HAL (hardware abstraction layer), i.e.: hal->setBrightness(255);

With Button 2/3 you can change the color (default behaviour) or the intensity (use '#define CHANGE_COLORS_INSTEAD_OF_BRIGHTNESS 0' in your config.h). Of course the display intensity is restored to it's previous state when switching to the next app/watchface. With the color changig mode this watchface can be used to detect dead pixels as well.

I didn't want to fork the repo and make a proper pull request, therefore i made a patch for anyone to use (which github doesn't allow as attachment...): Therefore unzip the patch in your open-smartwatch-os repo directory, apply it with git apply OswAppLamp.patch and add '#define TOOL_LAMP 1' to your config.h file in the include/ subdirectory. Then you're ready to go (which means running 'pio run -t upload' of course).

The patch: OswAppLamp.patch.zip