diff --git a/FabiWare/FlipWare.h b/FabiWare/FlipWare.h index f7849e6..958cc94 100644 --- a/FabiWare/FlipWare.h +++ b/FabiWare/FlipWare.h @@ -89,7 +89,7 @@ struct SlotSettings { uint8_t bt; // bt-mode (0,1,2) uint32_t sc; // slotcolor (0x: rrggbb) char kbdLayout[6]; - uint16_t lp; // Threshold long button press. // ASK. Whether it is supposed to go here and what the initials are supposed to be. + uint16_t lp; // Threshold long button press. }; /** diff --git a/FabiWare/commands.cpp b/FabiWare/commands.cpp index 88b80a7..90ab7c4 100644 --- a/FabiWare/commands.cpp +++ b/FabiWare/commands.cpp @@ -55,6 +55,9 @@ const struct atCommandType atCommands[] PROGMEM = { /***** keyboard *****/ {"KW" , PARTYPE_STRING}, {"KP" , PARTYPE_STRING}, {"KH" , PARTYPE_STRING}, {"KT" , PARTYPE_STRING }, {"KR" , PARTYPE_STRING}, {"RA" , PARTYPE_NONE }, {"KL" , PARTYPE_STRING }, + /***** Long press time/threshold. *****/ + {"LP", PARTYPE_UINT}, + /***** slots *****/ {"SA" , PARTYPE_STRING}, {"LO" , PARTYPE_STRING}, {"LA" , PARTYPE_NONE }, {"LI" , PARTYPE_NONE }, {"NE" , PARTYPE_NONE }, {"DE" , PARTYPE_STRING }, {"RS" , PARTYPE_NONE }, {"RE" , PARTYPE_NONE }, @@ -179,7 +182,7 @@ void performCommand (uint8_t cmd, int16_t par1, char * keystring, int8_t periodi mouseScroll(slotSettings.ws); break; case CMD_WS: - slotSettings.ws = par1; + slotSettings.ws = par1; // par1, Parameter. break; case CMD_MX: mouseMove(par1, 0); @@ -237,6 +240,11 @@ void performCommand (uint8_t cmd, int16_t par1, char * keystring, int8_t periodi printKeyboardLayout(); } break; + + case CMD_LP: + slotSettings.lp = par1; + break; + case CMD_RA: release_all(); break; diff --git a/FabiWare/commands.h b/FabiWare/commands.h index 31ff97e..8102be5 100644 --- a/FabiWare/commands.h +++ b/FabiWare/commands.h @@ -84,6 +84,8 @@ AT KL change keyboard layout. No parameter prints the currently used layout. Currently supported: de_DE, en_US, es_ES, fr_FR, it_IT, sv_SE, da_DK. + AT LP Long press threshold AKA long press should be active once that time (in [ms]) has been reached. + Housekeeping commands: AT SA save slotSettings and current button modes to next free eeprom slot under given name (e.g. "AT SA mouse1") @@ -121,6 +123,7 @@ AT IW wipe infrared memory (clear all codes) AT IL lists all stored infrared command names AT IT set code timeout value for IR Recording (e.g. "AT IT 10" sets 10 milliseconds timeout) + supported key identifiers for key commands (AT KP/KH/KR/KT): @@ -163,7 +166,7 @@ enum atCommands { CMD_ID, CMD_BM, CMD_CL, CMD_CR, CMD_CM, CMD_CD, CMD_PL, CMD_PR, CMD_PM, CMD_HL, CMD_HR, CMD_HM, CMD_RL, CMD_RR, CMD_RM, CMD_TL, CMD_TR, CMD_TM, CMD_WU, CMD_WD, CMD_WS, CMD_MX, CMD_MY, CMD_JX, CMD_JY, CMD_JZ, CMD_JT, CMD_JS, CMD_JP, CMD_JR, CMD_JH, CMD_KW, CMD_KP, CMD_KH, CMD_KT, CMD_KR, - CMD_RA, CMD_KL, CMD_SA, CMD_LO, CMD_LA, CMD_LI, CMD_NE, CMD_DE, CMD_RS, CMD_RE, CMD_NC, CMD_BT, + CMD_RA, CMD_KL, CMD_LP, CMD_SA, CMD_LO, CMD_LA, CMD_LI, CMD_NE, CMD_DE, CMD_RS, CMD_RE, CMD_NC, CMD_BT, CMD_SC, CMD_SR, CMD_ER, CMD_CA, CMD_MA, CMD_WA, CMD_TS, CMD_TP, CMD_SP, CMD_SS, CMD_IR, CMD_IP, CMD_IH, CMD_IS, CMD_IC, CMD_IW, CMD_IL, CMD_IT, NUM_COMMANDS diff --git a/FabiWare/modes.cpp b/FabiWare/modes.cpp index ddd4605..716674e 100644 --- a/FabiWare/modes.cpp +++ b/FabiWare/modes.cpp @@ -215,8 +215,7 @@ void handleUserInteraction() { // check physical buttons 1-5 (only if not handled by any special sip/puff state) if (strongSipPuffState == STRONG_MODE_IDLE) { - //uint16_t thresholdForLongPress = slotSettings.lp; // This should replace the one below. - uint16_t thresholdForLongPress = 500; // TODO: thresholdForLongPress should not have a hard coded value, seeing as the user decides the time (WebGUI => Timings). + uint16_t thresholdForLongPress = slotSettings.lp; static unsigned long buttonPressStartTime[NUMBER_OF_PHYSICAL_BUTTONS] = { 0 }; // Stores the start time of button presses. So that it can distinguish between the first time a button has been pressed. for (int i = 0; i < NUMBER_OF_PHYSICAL_BUTTONS; i++) { // update button press / release events