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