Skip to content

Commit d9d3867

Browse files
Fixes Mouse Clicker Should have a "0" value setting for "as fast as possible" #3876 (#3894)
* fixes mouse clicking rate * Hid: limit max clicks to 100/s, rewrite code to make it more robust Co-authored-by: あく <alleteam@gmail.com>
1 parent 421bd3e commit d9d3867

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

applications/system/hid_app/views/hid_mouse_clicker.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define TAG "HidMouseClicker"
88

99
#define DEFAULT_CLICK_RATE 1
10-
#define MAXIMUM_CLICK_RATE 60
10+
#define MAXIMUM_CLICK_RATE 100
1111

1212
struct HidMouseClicker {
1313
View* view;
@@ -34,7 +34,9 @@ static void hid_mouse_clicker_start_or_restart_timer(void* context) {
3434
HidMouseClickerModel * model,
3535
{
3636
furi_timer_start(
37-
hid_mouse_clicker->timer, furi_kernel_get_tick_frequency() / model->rate);
37+
hid_mouse_clicker->timer,
38+
furi_kernel_get_tick_frequency() /
39+
((model->rate) ? model->rate : MAXIMUM_CLICK_RATE));
3840
},
3941
true);
4042
}
@@ -75,7 +77,11 @@ static void hid_mouse_clicker_draw_callback(Canvas* canvas, void* context) {
7577

7678
// Clicks/s
7779
char label[20];
78-
snprintf(label, sizeof(label), "%d clicks/s", model->rate);
80+
if(model->rate) {
81+
snprintf(label, sizeof(label), "%d clicks/s", model->rate);
82+
} else {
83+
snprintf(label, sizeof(label), "max clicks/s");
84+
}
7985
elements_multiline_text_aligned(canvas, 28, 37, AlignCenter, AlignBottom, label);
8086

8187
canvas_draw_icon(canvas, 25, 20, &I_ButtonUp_7x4);
@@ -139,7 +145,7 @@ static bool hid_mouse_clicker_input_callback(InputEvent* event, void* context) {
139145
consumed = true;
140146
break;
141147
case InputKeyDown:
142-
if(model->rate > 1) {
148+
if(model->rate > 0) {
143149
model->rate--;
144150
}
145151
rate_changed = true;

0 commit comments

Comments
 (0)