Skip to content

Commit

Permalink
Possibly added everything for long press.
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonSmith43 committed Apr 24, 2024
1 parent e90b3e1 commit dd77cad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion FabiWare/FlipWare.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
};

/**
Expand Down
10 changes: 9 additions & 1 deletion FabiWare/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion FabiWare/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
AT KL <string> 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 <uint> Long press threshold AKA long press should be active once that time (in [ms]) has been reached.
Housekeeping commands:
AT SA <string> save slotSettings and current button modes to next free eeprom slot under given name (e.g. "AT SA mouse1")
Expand Down Expand Up @@ -121,6 +123,7 @@
AT IW wipe infrared memory (clear all codes)
AT IL lists all stored infrared command names
AT IT <uint> 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):
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions FabiWare/modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dd77cad

Please # to comment.