Skip to content

Commit 2f9f6ac

Browse files
committed
fix examples
avoid initialization order problem rendering keymaps unusable on some cases if calling keymap::getCmdChar function. initialized by the default data instead #147 #126
1 parent f5a54ba commit 2f9f6ac

File tree

11 files changed

+10
-20
lines changed

11 files changed

+10
-20
lines changed

examples/LCDs/LiquidCrystal/LiquidCrystal/LiquidCrystal.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
3535
encoderInStream<encA,encB> encStream(encoder,4);// simple quad encoder fake Stream
3636

3737
//a keyboard with only one key as the encoder button
38-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
38+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
3939
keyIn<1> encButton(encBtn_map);//1 is the number of keys
4040

4141
//input from the encoder + encoder button + serial

examples/LCDs/Malpartida/I2C/I2C/I2C.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ http://playground.arduino.cc/Code/LCD3wires
3838
encoderInStream<encA,encB> encStream(encoder,ENC_SENSIVITY);// simple quad encoder fake Stream
3939

4040
//a keyboard with only one key as the encoder button
41-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
41+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
4242
keyIn<1> encButton(encBtn_map);//1 is the number of keys
4343

4444
serialIn serial(Serial);

examples/LCDs/PCF8574/PCF8574/PCF8574.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
3636
encoderInStream<encA,encB> encStream(encoder,ENC_SENSIVITY);// simple quad encoder fake Stream
3737

3838
//a keyboard with only one key as the encoder button
39-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
39+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
4040
keyIn<1> encButton(encBtn_map);//1 is the number of keys
4141

4242
//input from the encoder + encoder button + serial

examples/U8G2/U8G2/U8G2.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
173173
encoderInStream<encA,encB> encStream(encoder,4);// simple quad encoder fake Stream
174174

175175
//a keyboard with only one key as the encoder button
176-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
176+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
177177
keyIn<1> encButton(encBtn_map);//1 is the number of keys
178178

179179
// menuIn* inputsList[]={&encBuitton,&Serial};

examples/U8GLib/U8Glib/U8GLib.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
152152
encoderInStream<encA,encB> encStream(encoder,4);// simple quad encoder fake Stream
153153

154154
//a keyboard with only one key as the encoder button
155-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, on = low
155+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, on = low
156156
keyIn<1> encButton(encBtn_map);//1 is the number of keys
157157

158158
serialIn serial(Serial);

examples/adafruitGfx/lcdMono/lcdMono/lcdMono.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
100100
encoderInStream<encA,encB> encStream(encoder,4);// simple quad encoder fake Stream
101101

102102
//a keyboard with only one key as the encoder button
103-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
103+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
104104
keyIn<1> encButton(encBtn_map);//1 is the number of keys
105105

106106
serialIn serial(Serial);

examples/adafruitGfx/tft/tft/tft.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
144144
encoderInStream<encA,encB> encStream(encoder,4);// simple quad encoder fake Stream
145145

146146
//a keyboard with only one key as the encoder button
147-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
147+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
148148
keyIn<1> encButton(encBtn_map);//1 is the number of keys
149149

150150
serialIn serial(Serial);

examples/ajoy/ajoy/ajoy.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ MENU(mainMenu,"Main menu",doNothing,noEvent,wrapStyle
4949
//joystick button pin
5050
#define joyBtn 4
5151

52-
keyMap btnsMap[]={{-joyBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
52+
keyMap btnsMap[]={{-joyBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
5353
keyIn<1> btns(btnsMap);// 1 is the number of keys
5454

5555
serialIn menuSerialIn(Serial);

examples/btnNav/btnNav/btnNav.ino

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,7 @@ void setup() {
161161
Serial.begin(115200);
162162
while(!Serial);
163163
pinMode(LEDPIN, OUTPUT);
164-
// pinMode(BTN_SEL,INPUT_PULLUP);
165-
// pinMode(BTN_UP,INPUT_PULLUP);
166-
// pinMode(BTN_DOWN,INPUT_PULLUP);
167164
joystickBtns.begin();
168-
Serial<<"options->navCodes: 0x"<<hex((int)options->navCodes)<<endl;
169-
Serial<<"options->navCodes["<<noCmd<<"]: 0x"<<hex(options->navCodes[0].ch)<<" 0x"<<hex(options->getCmdChar(noCmd))<<endl;
170-
Serial<<"options->navCodes["<<escCmd<<"]: 0x"<<hex(options->navCodes[1].ch)<<" 0x"<<hex(options->getCmdChar(escCmd))<<endl;
171-
Serial<<"options->navCodes["<<enterCmd<<"]: 0x"<<hex(options->navCodes[2].ch)<<" 0x"<<hex(options->getCmdChar(enterCmd))<<endl;
172-
for(int n=0;n<3;n++) {
173-
Serial<<joystickBtn_map[n].pin<<": 0x"<<hex(joystickBtn_map[n].code)<<"("<<(char)joystickBtn_map[n].code<<")"<<endl;
174-
}
175165
}
176166

177167
#define SOFT_DEBOUNCE_MS 100

examples/concurrent/concurrent/concurrent.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ encoderIn<encA,encB> encoder;//simple quad encoder driver
3737
encoderInStream<encA,encB> encStream(encoder,ENC_SENSIVITY);// simple quad encoder fake Stream
3838

3939
//a keyboard with only one key as the encoder button
40-
keyMap encBtn_map[]={{-encBtn,options->getCmdChar(enterCmd)}};//negative pin numbers use internal pull-up, this is on when low
40+
keyMap encBtn_map[]={{-encBtn,defaultOptions[enterCmd].ch}};//negative pin numbers use internal pull-up, this is on when low
4141
keyIn<1> encButton(encBtn_map);//1 is the number of keys
4242

4343
//input from the encoder + encoder button + serial

0 commit comments

Comments
 (0)