From ef5cb43d1cdbdb569fe4bb136ecd8565b986a161 Mon Sep 17 00:00:00 2001 From: sinseman Date: Sat, 30 Aug 2014 10:08:17 +0200 Subject: [PATCH] Optimizations --- Variometer/Variometer.ino | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Variometer/Variometer.ino b/Variometer/Variometer.ino index 790c19f..3771079 100644 --- a/Variometer/Variometer.ino +++ b/Variometer/Variometer.ino @@ -11,6 +11,10 @@ #include #include +///////////////////////////////////////// +bool initialisation = false; //If true, reset and update eeprom memory at arduino start +///////////////////////////////////////// + //////////////////RTC/////////////////////// RTC_DS1307 rtc; #define DATE_DAY 1 @@ -91,10 +95,6 @@ MenuItem m_recreset = MenuItem(NULL, MENU_RECRESET); //Reset records Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); ///////////////////////////////////////// -///////////////////////////////////////// -bool initialisation = false; //If true, reset and update eeprom memory at arduino start -///////////////////////////////////////// - /////////////////////VARIO///////////////////////// Adafruit_BMP085_Unified bmp085 = Adafruit_BMP085_Unified(10085); //set up bmp085 sensor #define ALTI_TRIGGER 4 //Trigger to start and stop chrono in meter @@ -308,9 +308,9 @@ void renderVarioBar() float vario_abs = abs(vario); display.fillRect(0, 32, 84, 9, WHITE); if (vario >= 0) - display.fillRect(42, 32, round(vario_abs * 15), 8, BLACK); + display.fillRect(42, 32, round(vario_abs * 10), 8, BLACK); else - display.drawRect(42, 32, -round(vario_abs * 15), 8, BLACK); + display.drawRect(42, 32, -round(vario_abs * 10), 8, BLACK); display.display(); } @@ -820,7 +820,7 @@ uint8_t getBeepLatency() uint16_t getBeepFrequency() { - int frequency = 790 + (200 * vario); + int frequency = 790 + (100 * vario); return (frequency < 100)? 100: (frequency > 1300)? 1300 :frequency; } @@ -922,8 +922,8 @@ void loop() } } - //every 67 milliseconds, - if (millis() >= (get_time1 + 67)) + //every 100 milliseconds, + if (millis() >= (get_time1 + 100)) { get_time1 = millis();