Skip to content

Commit

Permalink
Building errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Jan 3, 2025
1 parent dca5b16 commit 06acb1d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 317 deletions.
11 changes: 0 additions & 11 deletions boards/_New-Device-Model/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,6 @@ void powerOff() { }
**********************************************************************/
void checkReboot() { }


/*********************************************************************
** Function: _checkKeyPress
** location: mykeyboard.cpp
** returns the key from the keyboard
**********************************************************************/
keyStroke _getKeyPress() {
keyStroke key;
return key;
} // must return something that the keyboards won´t recognize by default

/*********************************************************************
** Function: _checkNextPagePress
** location: mykeyboard.cpp
Expand Down
262 changes: 0 additions & 262 deletions boards/smoochiee-board/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,268 +129,6 @@ void InputHandler(void) {
}
}


/*********************************************************************
** Function: keyboard
** location: mykeyboard.cpp
** Starts keyboard to type data
**********************************************************************/
String keyboard(String mytext, int maxSize, String msg) {
String _mytext = mytext;
resetTftDisplay();
bool caps=false;
int x=0;
int y=-1;
int x2=0;
int y2=0;
char keys[4][12][2] = { //4 lines, with 12 characteres, BTN_ACT and high caps
{
{ '1', '!' },//1
{ '2', '@' },//2
{ '3', '#' },//3
{ '4', '$' },//4
{ '5', '%' },//5
{ '6', '^' },//6
{ '7', '&' },//7
{ '8', '*' },//8
{ '9', '(' },//9
{ '0', ')' },//10
{ '-', '_' },//11
{ '=', '+' } //12
},
{
{ 'q', 'Q' },//1
{ 'w', 'W' },//2
{ 'e', 'E' },//3
{ 'r', 'R' },//4
{ 't', 'T' },//5
{ 'y', 'Y' },//6
{ 'u', 'U' },//7
{ 'i', 'I' },//8
{ 'o', 'O' },//9
{ 'p', 'P' },//10
{ '[', '{' },//11
{ ']', '}' } //12
},
{
{ 'a', 'A' },//1
{ 's', 'S' },//2
{ 'd', 'D' },//3
{ 'f', 'F' },//4
{ 'g', 'G' },//5
{ 'h', 'H' },//6
{ 'j', 'J' },//7
{ 'k', 'K' },//8
{ 'l', 'L' },//9
{ ';', ':' },//10
{ '"', '\'' },//11
{ '|', '\\' } //12
},
{
{ '\\', '|' },//1
{ 'z', 'Z' },//2
{ 'x', 'X' },//3
{ 'c', 'C' },//4
{ 'v', 'V' },//5
{ 'b', 'B' },//6
{ 'n', 'N' },//7
{ 'm', 'M' },//8
{ ',', '<' },//9
{ '.', '>' },//10
{ '?', '/' },//11
{ '/', '/' } //12
}
};
int _x = tftWidth/12;
int _y = (tftHeight - 54)/4;
int _xo = _x/2-3;

int i=0;
int j=-1;
bool redraw=true;
int cX =0;
int cY =0;
tft.fillScreen(bruceConfig.bgColor);
while(1) {
if(redraw) {
tft.setCursor(0,0);
tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.setTextSize(FM);

//Draw the rectangles
if(y<0) {
tft.fillRect(0,1,tftWidth,22,bruceConfig.bgColor);
tft.drawRect(7,2,46,20,TFT_WHITE); // Ok Rectangle
tft.drawRect(55,2,50,20,TFT_WHITE); // CAP Rectangle
tft.drawRect(107,2,50,20,TFT_WHITE); // DEL Rectangle
tft.drawRect(159,2,74,20,TFT_WHITE); // SPACE Rectangle
tft.drawRect(3,32,tftWidth-3,20,bruceConfig.priColor); // mystring Rectangle


if(x==0 && y==-1) { tft.setTextColor(bruceConfig.bgColor, TFT_WHITE); tft.fillRect(7,2,50,20,TFT_WHITE); }
else tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.drawString("OK", 18, 4);


if(x==1 && y==-1) { tft.setTextColor(bruceConfig.bgColor, TFT_WHITE); tft.fillRect(55,2,50,20,TFT_WHITE); }
else if(caps) { tft.fillRect(55,2,50,20,TFT_DARKGREY); tft.setTextColor(TFT_WHITE, TFT_DARKGREY); }
else tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.drawString("CAP", 64, 4);


if(x==2 && y==-1) { tft.setTextColor(bruceConfig.bgColor, TFT_WHITE); tft.fillRect(107,2,50,20,TFT_WHITE); }
else tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.drawString("DEL", 115, 4);

if(x>2 && y==-1) { tft.setTextColor(bruceConfig.bgColor, TFT_WHITE); tft.fillRect(159,2,74,20,TFT_WHITE); }
else tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.drawString("SPACE", 168, 4);
}

tft.setTextSize(FP);
tft.setTextColor(TFT_WHITE, 0x5AAB);
tft.drawString(msg.substring(0,38), 3, 24);

tft.setTextSize(FM);

// reseta o quadrado do texto
if (mytext.length() == 19 || mytext.length() == 20 || mytext.length() == 38 || mytext.length() == 39) tft.fillRect(3,32,tftWidth-3,20,bruceConfig.bgColor); // mystring Rectangle
// escreve o texto
tft.setTextColor(TFT_WHITE);
if(mytext.length()>19) {
tft.setTextSize(FP);
if(mytext.length()>38) {
tft.drawString(mytext.substring(0,38), 5, 34);
tft.drawString(mytext.substring(38,mytext.length()), 5, 42);
}
else {
tft.drawString(mytext, 5, 34);
}
} else {
tft.drawString(mytext, 5, 34);
}
//desenha o retangulo colorido
tft.drawRect(3,32,tftWidth-3,20,bruceConfig.priColor); // mystring Rectangle


tft.setTextColor(TFT_WHITE, bruceConfig.bgColor);
tft.setTextSize(FM);


for(i=0;i<4;i++) {
for(j=0;j<12;j++) {
//use last coordenate to paint only this letter
if(x2==j && y2==i) { tft.setTextColor(~bruceConfig.bgColor, bruceConfig.bgColor); tft.fillRect(j*_x,i*_y+54,_x,_y,bruceConfig.bgColor);}
/* If selected, change font color and draw Rectangle*/
if(x==j && y==i) { tft.setTextColor(bruceConfig.bgColor, ~bruceConfig.bgColor); tft.fillRect(j*_x,i*_y+54,_x,_y,~bruceConfig.bgColor);}


/* Print the letters */
if(!caps) tft.drawChar(keys[i][j][0], (j*_x+_xo), (i*_y+56));
else tft.drawChar(keys[i][j][1], (j*_x+_xo), (i*_y+56));

/* Return colors to normal to print the other letters */
if(x==j && y==i) { tft.setTextColor(~bruceConfig.bgColor, bruceConfig.bgColor); }
}
}
// save actual key coordenate
x2=x;
y2=y;
redraw = false;

delay(200);
}

//cursor handler
if(mytext.length()>19) {
tft.setTextSize(FP);
if(mytext.length()>38) {
cY=42;
cX=5+(mytext.length()-38)*LW;
}
else {
cY=34;
cX=5+mytext.length()*LW;
}
} else {
cY=34;
cX=5+mytext.length()*LW*2;
}

/* When Select a key in keyboard */
int z=0;

if(check(SelPress)) {
tft.setCursor(cX,cY);
if(caps) z=1;
else z=0;
if(x==0 && y==-1) break;
else if(x==1 && y==-1) caps=!caps;
else if(x==2 && y==-1 && mytext.length() > 0) {
DEL:
mytext.remove(mytext.length()-1);
int fS=FM;
if(mytext.length()>19) { tft.setTextSize(FP); fS=FP; }
else tft.setTextSize(FM);
tft.setCursor((cX-fS*LW),cY);
tft.setTextColor(bruceConfig.priColor,bruceConfig.bgColor);
tft.print(" ");
tft.setTextColor(TFT_WHITE, 0x5AAB);
tft.setCursor(cX-fS*LW,cY);
cX=tft.getCursorX();
cY=tft.getCursorY();
}
else if(x>2 && y==-1 && mytext.length()<maxSize) mytext += " ";
else if(y>-1 && mytext.length()<maxSize) {
ADD:
mytext += keys[y][x][z];
if(mytext.length()!=20 && mytext.length()!=20) tft.print(keys[y][x][z]);
cX=tft.getCursorX();
cY=tft.getCursorY();
}
redraw = true;
}

/* Down Btn to move in X axis (to the right) */
if(digitalRead(DW_BTN)==BTN_ACT)
{
x++;
if(y<0 && x>3) x=0;
if(x>11) x=0;
else if (x<0) x=11;
redraw = true;
}
if(digitalRead(UP_BTN)==BTN_ACT)
{
x--;
if(y<0 && x>3) x=0;
if(x>11) x=0;
else if (x<0) x=11;
redraw = true;
}
/* UP Btn to move in Y axis (Downwards) */
if(digitalRead(R_BTN)==BTN_ACT) {
y++;
if(y>3) { y=-1; }
else if(y<-1) y=3;
redraw = true;
}
if(digitalRead(L_BTN)==BTN_ACT) {
y--;
if(y>3) { y=-1; }
else if(y<-1) y=3;
redraw = true;
}
}

//Resets screen when finished writing
tft.fillRect(0,0,tftWidth,tftHeight,bruceConfig.bgColor);
resetTftDisplay();

return mytext;
}


/*********************************************************************
** Function: powerOff
** location: mykeyboard.cpp
Expand Down
25 changes: 0 additions & 25 deletions include/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,3 @@ void powerOff();
** Btn logic to tornoff the device (name is odd btw)
**********************************************************************/
void checkReboot();

#if defined(HAS_KEYBOARD) // related functions

/*********************************************************************
** Function: _checkKeyPress
** location: mykeyboard.cpp
** returns the key from the keyboard
**********************************************************************/
keyStroke _getKeyPress(); // must return something that the keyboards won´t recognize by default

/*********************************************************************
** Function: _checkNextPagePress
** location: mykeyboard.cpp
** returns the key from the keyboard
**********************************************************************/
bool _checkNextPagePress();

/*********************************************************************
** Function: _checkPrevPagePress
** location: mykeyboard.cpp
** returns the key from the keyboard
**********************************************************************/
bool _checkPrevPagePress();

#endif
24 changes: 5 additions & 19 deletions src/core/mykeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,8 @@ keyStroke _getKeyPress() {
** Jumps 5 items from file list
**********************************************************************/
bool checkNextPagePress(){
if(check(NextPagePress))
{
if(wakeUpScreen()){
delay(200);
return false;
}
return true;
}
return false;
if(check(NextPagePress)) return true;
else return false;
}

/*********************************************************************
Expand All @@ -84,15 +77,8 @@ bool checkNextPagePress(){
** Jumps -5 items from file list
**********************************************************************/
bool checkPrevPagePress() {
if(check(PrevPagePress))
{
if(wakeUpScreen()){
delay(200);
return false;
}
return true;
}
return false;
if(check(PrevPagePress)) return true;
else return false;
}


Expand Down Expand Up @@ -501,7 +487,7 @@ String keyboard(String mytext, int maxSize, String msg) {
/* Down Btn to move in X axis (to the right) */
if(check(NextPress))
{
if(check(EscPress) { y++; }
if(check(EscPress)) { y++; }
else if ((x >= 3 && y < 0) || x == 11) { y++; x = 0; }
else x++;

Expand Down

0 comments on commit 06acb1d

Please sign in to comment.