Skip to content

Commit

Permalink
Dynamic Macro Recording Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
plodah committed Aug 22, 2024
1 parent 66e0195 commit e22f021
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions users/plodah/functions/kc_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ bool kc_handler(uint16_t keycode, keyrecord_t *record) {
plodah_typingindicator_start();
# endif // PLODAH_TYPINGINDICATOR_RGBINDEX

# if defined(DYNAMIC_MACRO_ENABLE) && defined(PLODAH_DYNAMIC_MACRO_TIMEOUT)
dynamic_macro_loop_timer = timer_read();
# endif // defined(DYNAMIC_MACRO_ENABLE) && defined(PLODAH_DYNAMIC_MACRO_TIMEOUT)

switch (keycode) {
// Static version keycode
case PL_VERS:
Expand Down
16 changes: 11 additions & 5 deletions users/plodah/plodah.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#endif // CAPS_WORD_ENABLE
#if defined(DYNAMIC_MACRO_ENABLE) && defined (RGB_MATRIX_ENABLE) && defined (PLODAH_DMAC_INDIC_INDEX)
bool is_dynamic_macro_recording = false;
//uint16_t dynamic_macro_loop_timer;
uint16_t dynamic_macro_loop_timer;
#endif // DYNAMIC_MACRO_ENABLE && RGB_MATRIX_ENABLE && PLODAH_DMAC_INDIC_INDEX

//===================//
Expand Down Expand Up @@ -113,10 +113,14 @@ void matrix_scan_user(void) {
# if defined (PLODAH_TYPINGINDICATOR_RGBINDEX)
plodah_typingindicator_check();
# endif // PLODAH_TYPINGINDICATOR_RGBINDEX
# if defined(DYNAMIC_MACRO_ENABLE) && defined(PLODAH_DYNAMIC_MACRO_TIMEOUT)
if (timer_elapsed(dynamic_macro_loop_timer) > PLODAH_DYNAMIC_MACRO_TIMEOUT){
dynamic_macro_stop_recording();
}
# endif // defined(DYNAMIC_MACRO_ENABLE) && defined(PLODAH_DYNAMIC_MACRO_TIMEOUT)
}
#endif // (defined(PLODAH_ALTTAB_ENHANCEMENTS_ENABLE)) || ( defined(AUTOCORRECT_ENABLE) && defined(RGB_MATRIX_ENABLE) ) || (defined(PLODAH_TYPINGINDICATOR_RGBINDEX))


//==========================//
// CAPS INDICATOR //
//==========================//
Expand Down Expand Up @@ -149,12 +153,14 @@ void matrix_scan_user(void) {
//==========================//
// DYNAMIC MACROS //
//==========================//
#if defined(DYNAMIC_MACRO_ENABLE) && defined (RGB_MATRIX_ENABLE) && defined (PLODAH_DMAC_INDIC_INDEX)
#if defined(DYNAMIC_MACRO_ENABLE)
void dynamic_macro_record_start_user(int8_t direction) {
is_dynamic_macro_recording = true;
//dynamic_macro_loop_timer = timer_read();
# if defined(PLODAH_DYNAMIC_MACRO_TIMEOUT)
dynamic_macro_loop_timer = timer_read();
# endif // PLODAH_DYNAMIC_MACRO_TIMEOUT
}
void dynamic_macro_record_end_user(int8_t direction) {
is_dynamic_macro_recording = false;
}
#endif // DYNAMIC_MACRO_ENABLE && RGB_MATRIX_ENABLE && PLODAH_DMAC_INDIC_INDEX
#endif // DYNAMIC_MACRO_ENABLE
4 changes: 4 additions & 0 deletions users/plodah/plodah.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
# define DEBOUNCE 20
#endif // DEBOUNCE

# if defined(DYNAMIC_MACRO_ENABLE) && (! defined(PLODAH_DYNAMIC_MACRO_TIMEOUT))
# define PLODAH_DYNAMIC_MACRO_TIMEOUT 10000
#endif // DYNAMIC_MACRO_ENABLE

#ifndef TAPPING_TERM
# define TAPPING_TERM 180
#endif // TAPPING_TERM
Expand Down

0 comments on commit e22f021

Please sign in to comment.