Skip to content

Commit

Permalink
Added fixes for keystring buffer, bumping version to 2.12.1
Browse files Browse the repository at this point in the history
  • Loading branch information
beni committed Oct 14, 2022
1 parent 6fc998b commit 3fcf63a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion FLipWare/FlipWare.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include "bluetooth.h"
#include "hid_hal.h"

#define VERSION_STRING "v2.12"
#define VERSION_STRING "v2.12.1"

// V2.12.1: fixed keystring buffer problem
// V2.12: improved modularisation and source code documentation, added LC-display support and elliptical deadzone
// V2.11: eeprom access optimization and support for deletion / update of individual slots
// V2.10: code size reduction: using floating point math, removed debug level control via AT E0, AT E1 and AT E2
Expand Down
14 changes: 12 additions & 2 deletions FLipWare/buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ char * getButtonKeystring(int num)
{
char * str = keystringBuffer;
for (int i=0;i<num;i++) {
while (*str++);
if(*str) while(*str++);
else str++;
}
return(str);
}
Expand Down Expand Up @@ -79,7 +80,16 @@ uint16_t setButtonKeystring(uint8_t buttonIndex, char * newKeystring)
}

strcpy (keystringAddress, newKeystring); // store the new keystring!
buttonKeystrings[buttonIndex] = keystringAddress; // remember it's address

//update ALL keystring pointers, because we might have moved some of them
char * x = keystringBuffer;
for (int i=0;i<NUMBER_OF_BUTTONS;i++) {
if (*x) {
buttonKeystrings[i] = x;
while (*x++);
} else x++;
}

slotSettings.keystringBufferLen += delta; // update buffer length

#ifdef DEBUG_OUTPUT_FULL
Expand Down

0 comments on commit 3fcf63a

Please sign in to comment.