This commit is contained in:
Thomas Livernet
2014-02-11 12:23:54 +01:00
parent 54b1d37913
commit eaa57fcbb1
3 changed files with 87 additions and 87 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 KiB

After

Width:  |  Height:  |  Size: 657 KiB

View File

@@ -4,7 +4,7 @@
#include <Encoder.h>
#include <Wire.h> //i2c library
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h> //bmp085 library, download from url link (1)
#include <Adafruit_BMP085_U.h>
#include <toneAC.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
@@ -360,7 +360,7 @@ void renderStatItem(float value, const __FlashStringHelper *unit, bool integer =
menuUsed = false;
display.setTextColor(BLACK);
if (integer == true){
if (integer == true) {
display.print((int)value);
}
else {
@@ -626,13 +626,13 @@ void renderMenu(MenuItem newMenuItem = menu.getCurrent(), uint8_t dir = 2)
//display.println(F("Annee"));
break;
case DATE_HOUR:
if (dir == MENU_RIGHT) (date_hour >= 23) ? date_hour = 0 : date_hour++;
if (dir == MENU_LEFT) (date_hour == 0) ? date_hour = 23 : date_hour--;
if (dir == MENU_RIGHT) (date_hour >= 23) ? date_hour = 0 : date_hour++;
if (dir == MENU_LEFT) (date_hour == 0) ? date_hour = 23 : date_hour--;
//display.println(F("Heure"));
break;
case DATE_MINUTE:
if (dir == MENU_RIGHT) (date_minute >= 59) ? date_minute = 0 : date_minute++;
if (dir == MENU_LEFT)(date_minute == 0) ? date_minute = 59 : date_minute--;
if (dir == MENU_RIGHT) (date_minute >= 59) ? date_minute = 0 : date_minute++;
if (dir == MENU_LEFT)(date_minute == 0) ? date_minute = 59 : date_minute--;
//display.println(F("Minute"));
break;
}
@@ -654,14 +654,14 @@ void renderMenu(MenuItem newMenuItem = menu.getCurrent(), uint8_t dir = 2)
display.setTextSize(1);
display.setTextColor(WHITE, BLACK);
if (stat_to_display.chrono == 0){
if (stat_to_display.chrono == 0) {
display.print(F("M"));
display.print(stat_displayed);
display.print(F(" vide"));
}
else {
if (stat_blink_status){
if (stat_blink_status) {
renderDateTime(DateTime(stat_to_display.chrono_start));
display.println();
@@ -683,12 +683,12 @@ void renderMenu(MenuItem newMenuItem = menu.getCurrent(), uint8_t dir = 2)
display.print(F("Tx max:"));
float m = floor(stat_to_display.txchutemax);
m = m + (round(10 * stat_to_display.txchutemax) - (10 * m))/10;
m = m + (round(10 * stat_to_display.txchutemax) - (10 * m)) / 10;
renderStatItem(m, F("m/s"));
display.print(F("Tx Min:"));
m = floor(stat_to_display.txchutemin);
m = m + (round(10 * stat_to_display.txchutemin) - (10 * m))/10;
m = m + (round(10 * stat_to_display.txchutemin) - (10 * m)) / 10;
renderStatItem(m, F("m/s"));
display.print(F("Cumul:"));
@@ -735,14 +735,19 @@ void menuSetup()
This is the structure of the modelled menu
Vario
Stats
Retour
Statistiques
Reset
Options
Retour
Tare
Altitude
Montée
Montee
Descente
Light
Contra
Date
*/
m_vario.addAfter(m_stats);
@@ -767,10 +772,7 @@ void menuSetup()
}
/*
This is an important function
Here all use events are handled
This is where you define a behaviour for a menu item
Here all menu use events are handled
*/
void menuUseEvent(MenuUseEvent used)
{
@@ -787,9 +789,7 @@ void menuUseEvent(MenuUseEvent used)
}
/*
This is an important function
Here we get a notification whenever the user changes the menu
That is, when the menu is navigated
That is when the user changes the menu
*/
void menuChangeEvent(MenuChangeEvent changed)
{
@@ -927,10 +927,10 @@ void loop()
get_time2 = millis();
if (stat.chrono_start != 0 && vario > 0) {
stat.cumul_alt += vario;
stat.cumul_alt += vario;
}
if (menu.getCurrent().getShortkey() == MENU_STAT){
if (menu.getCurrent().getShortkey() == MENU_STAT) {
menu.use();
}
@@ -1004,7 +1004,7 @@ void readButtons()
//Serial.print(newKnobPosition);
//Serial.print(F(" / "));
//Serial.println(knobPosition);
if (abs(newKnobPosition-knobPosition) >= ENCODER_STEP) {
if (abs(newKnobPosition - knobPosition) >= ENCODER_STEP) {
if (newKnobPosition > knobPosition) { //Right
if (!menuUsed && varioState == false) {
if (menu.getCurrent().getShortkey() == MENU_STAT && stat_displayed < NB_STATS) {