Open-Smartwatch / open-smartwatch-os

The Open-Smartwatch Operating System.
https://open-smartwatch.github.io
GNU General Public License v3.0
984 stars 161 forks source link

Setting Button (TimeOut) Through the Web Interface #258

Closed FranseFrikandel closed 2 years ago

FranseFrikandel commented 2 years ago

Maybe I am just exceptionally impatient, but the long button presses were taking too long for my liking, so I made them configurable via config.h. web-interface.

FranseFrikandel commented 2 years ago

I had changed both the long press to reset the stopwatch, and the long press to switch between apps. If you prefer I could change the PR to be only the one between switching apps.

Definetly willing to look into implementing it into the web interface, but I haven't gotten WiFi on my watch working yet, will get back to that this evening.

RuffaloLavoisier commented 2 years ago

@FranseFrikandel I'm sorry, I didn't quite understand. There is not enough explanation for PR. Would you explain in detail? 😆

What do you mean?

  1. Does it mean that the screen switching time between apps is long when you press the button?
  2. Does it mean that the initialization time of the stopwatch is long?

For your information, your PR is 2(initialization time of the stopwatch).

FranseFrikandel commented 2 years ago

@FranseFrikandel I'm sorry, I didn't quite understand. There is not enough explanation for PR. Would you explain in detail? 😆

What do you mean?

1. Does it mean that the screen switching time between apps is long when you press the button?

2. Does it mean that the initialization time of the stopwatch is long?

For your information, your PR is 2(initialization time of the stopwatch).

The PR makes the long press time configurable for both app switching and resetting the stopwatch, as both of these were too long for my liking.

My changes in include/osw_hal.h are for customizable long press times to switch between apps (bottom left button). This was currently hardcoded to 1000 milliseconds, and reflected in the variable DEFAULTLAUNCHER_LONG_PRESS. The default remains the same as before at 1000 milliseconds but is now editable via changing DEFAULTLAUNCHER_LONG_PRESS in your config.h

The changes to stopwatch.cpp are the long press to reset the stopwatch once you have paused it (bottom right button). (so setting it back to 0) This was currently hardcoded to 1800ms and is now also configurable via the new variable TOOL_STOPWATCH_BTN_TIMEOUT. This variable also still defaults to its original 1800ms just as the switching between apps before.

So as an example, in my config.h I have now set this:

#define TOOL_STOPWATCH_BTN_TIMEOUT 800
#define DEFAULTLAUNCHER_LONG_PRESS 600

Which makes resetting the stopwatch take 800ms, and switching between apps 600ms.

So to answer both questions directly:

  1. The time I had to hold the button down to switch between apps instead of switching between pages in apps was too long for my liking and adressed in this PR.
  2. Not the initialization of the stopwatch, but the time you had to hold down the reset button of the stopwatch to reset the counter back to 0.

Hope this clarifies everything.

FranseFrikandel commented 2 years ago

I will get to these changes once I get the WiFi working on my watch 😅.

simonmicro commented 2 years ago

I think the idea is great and dead-simple to be implemented. @RuffaloLavoisier you should keep in mind, that any variable accessible inside the web interface can also be default-initialized using the config.h header file. I'll just slap something together quickly and push it into the forks branch. Just a minute :)

@FranseFrikandel can then decide if the changes are to his/her linking :)

simonmicro commented 2 years ago

Ah shit. I f*ed this PR - GitHub seems to close it if I remove all commits?! I'm very sorry - I'll reopen an other PR as a replacement from my fork!

@FranseFrikandel Sorry, could you checkout #262 instead?