Commit 1ed5da3c authored by AlaskaLinuxUser's avatar AlaskaLinuxUser

screen updates and button updates.

parent 4cbf34cc
......@@ -90,32 +90,32 @@ int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnLEFT 1
#define btnDOWN 2
#define btnLEFT 3
#define btnUP 3
#define btnSELECT 4
#define btnBACK 5
#define btnNONE 6
int read_LCD_buttons(){ // read the buttons
adc_key_in = 0;
//adc_key_in = analogRead(A0); // read the value from the sensor
Serial.print("anolog0:"); Serial.println(adc_key_in);
adc_key_in = analogRead(A0); // read the value from the sensor
//Serial.print("anolog0:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnRIGHT;
//adc_key_in = analogRead(A1); // read the value from the sensor
Serial.print("anolog1:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnUP;
adc_key_in = analogRead(A1); // read the value from the sensor
//Serial.print("anolog1:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnLEFT;
adc_key_in = analogRead(A2); // read the value from the sensor
Serial.print("anolog2:"); Serial.println(adc_key_in);
//Serial.print("anolog2:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnDOWN;
adc_key_in = analogRead(A3); // read the value from the sensor
Serial.print("anolog3:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnLEFT;
//Serial.print("anolog3:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnUP;
adc_key_in = analogRead(A4); // read the value from the sensor
Serial.print("anolog4:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnSELECT;
//Serial.print("anolog4:"); Serial.println(adc_key_in);
if (adc_key_in < 750 && adc_key_in > 550) return btnSELECT;
adc_key_in = analogRead(A5); // read the value from the sensor
Serial.print("anolog5:"); Serial.println(adc_key_in);
//Serial.print("anolog5:"); Serial.println(adc_key_in);
if (adc_key_in > 550) return btnBACK;
return btnNONE; // when all others fail, return this.
}
......@@ -210,8 +210,8 @@ void printMenu(void) {
void loop() {
//Get the time.
char buffer[23];
fona.getTime(buffer, 23);
char buffer[23];
fona.getTime(buffer, 23);
//*********************** Status Bar ******************
// Build the information bar.
......@@ -252,11 +252,11 @@ void loop() {
lcd.print("-0- ");
} else {
Serial.print(smsnum); Serial.println(F(" SMS's"));
lcd.println(smsnum);
lcd.println(smsnum-1);
}
Serial.print(F("> "));
updateScreen++;
} else if (updateScreen == 10000) {
} else if (updateScreen == 30) {
updateScreen = -1;
} else {
......@@ -340,8 +340,8 @@ void loop() {
case 7:{ // Type message screen // TODO: make this work.
lcd.setCursor(0, 1);
lcd.print("TYPE MESSAGE:");
lcd.setCursor(0, 4);
lcd.print("-SELECT TO SEND-");
lcd.setCursor(0, 5);
lcd.print("SELECT SENDS");
break;
}
case 8:{ // Delete all messages screen.
......@@ -356,8 +356,8 @@ void loop() {
break;
}
case 9:{ // View all messages screen // TODO: make this work.
lcd.setCursor(0, 4);
lcd.print("-SELECT TO SCROLL-");
lcd.setCursor(0, 5);
lcd.print("SELECT SCROLLs");
break;
}
case 10:{ // Read message screen // TODO: make this work.
......@@ -404,7 +404,7 @@ void loop() {
break;
}
case 15:{ // Network info screen
/* read the RSSI
// read the RSSI
uint8_t n = fona.getRSSI();
int8_t r;
......@@ -414,10 +414,12 @@ void loop() {
if (n == 31) r = -52;
if ((n >= 2) && (n <= 30)) {
r = map(n, 2, 30, -110, -54);
}*/
}
fona.getNetworkInfo();
lcd.setCursor(0, 1);
lcd.print(replybuffer);
lcd.print("SIGNAL STRENGTH:");
lcd.setCursor(0, 3);
lcd.print(r);
lcd.setCursor(0, 4);
lcd.print("MAIN MENU");
break;
......@@ -427,26 +429,28 @@ void loop() {
//*********************** Screen updates ******************
//*********************** Button Reading ******************
lcd_key = read_LCD_buttons(); // read the buttons
int waiting = 0;
while ( waiting < 3000 ){
menuNumber = 0;
while ( waiting < 30 ){
waiting++;
delay(1);
delay(10);
lcd_key = read_LCD_buttons(); // read the buttons
// TESTING ONLY // Serial.print(lcd_key);
switch (lcd_key){
case btnRIGHT:{
case btnUP:{
menuNumber = (1+screenNumber)*screenNumber;
break;
}
case btnLEFT:{
case btnDOWN:{
menuNumber = (2+screenNumber)*screenNumber;
break;
}
case btnUP:{
case btnLEFT:{
menuNumber = (3+screenNumber)*screenNumber;
break;
}
case btnDOWN:{
case btnRIGHT:{
menuNumber = (4+screenNumber)*screenNumber;
break;
}
......@@ -459,6 +463,7 @@ void loop() {
break;
}
}
// TESTING ONLY // Serial.print(menuNumber);
}
//*********************** Button Reading ******************
......@@ -644,6 +649,14 @@ void loop() {
screenNumber = 1;
break;
}
case 255:{ // Screen 15 - Network info.
screenNumber = 1;
break;
}
case 256:{ // Screen 15 - Network info.
screenNumber = 1;
break;
}
// That is screen 1 through 15 buttons.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment