diff --git a/watchX/lib/SSD1306/oled.cpp b/watchX/lib/SSD1306/oled.cpp index a19e3ef..cc8f254 100644 --- a/watchX/lib/SSD1306/oled.cpp +++ b/watchX/lib/SSD1306/oled.cpp @@ -5,7 +5,7 @@ #include "oled.h" uint8_t uiX,uiY; - + unsigned char mbuf[1024]; /* Over a long run session, memory becomes fragmented and eventually an allocation fails due to lack of a sufficiently large free area, @@ -17,19 +17,19 @@ void ssd1306_configure(){ const uint8_t s_oled128x64_initData[] = { - // SSD1306_DISPLAYOFF, // display off + SSD1306_DISPLAYOFF, // display off SSD1306_MEMORYMODE, HORIZONTAL_ADDRESSING_MODE, // Page Addressing mode SSD1306_COMSCANDEC, // Scan from 127 to 0 (Reverse scan) -// SSD1306_SETSTARTLINE | 0x00, // First line to start scanning from + SSD1306_SETSTARTLINE | 0x00, // First line to start scanning from SSD1306_SETCONTRAST, 0xFF, // contast value to 0x7F according to datasheet SSD1306_SEGREMAP | 0x01, // Use reverse mapping. 0x00 - is normal mapping - // SSD1306_NORMALDISPLAY, - // SSD1306_SETMULTIPLEX, 63, // Reset to default MUX. See datasheet + SSD1306_NORMALDISPLAY, + SSD1306_SETMULTIPLEX, 63, // Reset to default MUX. See datasheet // SSD1306_SETDISPLAYOFFSET, 0x00, // no offset // SSD1306_SETDISPLAYCLOCKDIV, 0x80,// set to default ratio/osc frequency // SSD1306_SETPRECHARGE, 0xF1, // switch precharge to 0x22 // 0xF1 // SSD1306_SETCOMPINS, 0x12, // set divide ratio - // SSD1306_SETVCOMDETECT, 0x40, // vcom deselect to 0x20 // 0x40 + SSD1306_SETVCOMDETECT, 0x40, // vcom deselect to 0x20 // 0x40 SSD1306_CHARGEPUMP, 0x14, // Enable charge pump // 0X20,0X80, @@ -37,10 +37,10 @@ void ssd1306_configure(){ SSD1306_DISPLAYON }; -for( uint8_t i=0; i",smallFont); - - - - -} diff --git a/watchX/src/menu.cpp b/watchX/src/menu.cpp index 1939b13..1a4c5c5 100644 --- a/watchX/src/menu.cpp +++ b/watchX/src/menu.cpp @@ -4,7 +4,7 @@ #include "watchX.h" #include "menu.h" -#include "diag.h" +#include "torch.h" #include "oled.h" #include "gyrocube.h" #include "settings.h" @@ -37,8 +37,8 @@ void menusw1( ){ case MENU_BLUETOOTH: gotoBlueTooth(); break; - case MENU_DIAGNOSTIC: - // gotoDiagnostic(); + case MENU_TORCH: + gotoTorch(); break; case MENU_SETTINGS: @@ -91,7 +91,7 @@ targetmenuindex=MENUCOUNT-1; When memory is dynamically allocated, the atmega chip cannot allocate memory ... */ const char title[][15] PROGMEM= {"< MAIN MENU >","< SETTINGS >"}; -const char menuCap[][15] PROGMEM ={"Exit","Stopwatch","Gyrocube","Diagnostic","Messages","Settings","About","Help","Bluetooth","Screen","Settings3","Settings4","Settings5","Settings6","Settings7","Settings8"}; +const char menuCap[][15] PROGMEM ={"Exit","Stopwatch","Gyrocube","Torch","Messages","Settings","About","Help","Bluetooth","Screen","Settings3","Settings4","Settings5","Settings6","Settings7","Settings8"}; void drawMenus(){ ///char menuCap[][15]={"Exit","Stopwatch","Gyrocube","Diagnostic","Bluetooth","Settings"}; //const char* title PROGMEM= "< MAIN MENU >"; diff --git a/watchX/src/menu.h b/watchX/src/menu.h index 44571b5..ed4aa13 100644 --- a/watchX/src/menu.h +++ b/watchX/src/menu.h @@ -7,11 +7,11 @@ extern uint8_t menuapp; extern int menuindex; extern int menuspeed; - #define MENUCOUNT 0x08 + #define MENUCOUNT 0x06 #define MENU_WATCH 0 #define MENU_STOPWATCH 1 #define MENU_GYROCUBE 2 -#define MENU_DIAGNOSTIC 3 +#define MENU_TORCH 3 #define MENU_BLUETOOTH 4 #define MENU_SETTINGS 5 diff --git a/watchX/src/torch.cpp b/watchX/src/torch.cpp new file mode 100644 index 0000000..899da50 --- /dev/null +++ b/watchX/src/torch.cpp @@ -0,0 +1,19 @@ +#include "watchX.h" +#include "torch.h" +#include "oled.h" + +#include "temperature.h" + + + +void drawTorch(){ + +for(uint16_t a=0;a<1024;a++) +mbuf[a]=0xff; +//drawString(16,0,"< TORCH >",smallFont); +digitalWrite(13,HIGH); +digitalWrite(6,HIGH); + + + +} diff --git a/watchX/src/diag.h b/watchX/src/torch.h similarity index 67% rename from watchX/src/diag.h rename to watchX/src/torch.h index 424d2cc..84ad540 100644 --- a/watchX/src/diag.h +++ b/watchX/src/torch.h @@ -1,8 +1,8 @@ #ifndef DIAG_H #define DIAG_H - -void drawDiag(); + +void drawTorch(); #endif diff --git a/watchX/src/watchX.cpp b/watchX/src/watchX.cpp index b02dd72..cd30bf9 100644 --- a/watchX/src/watchX.cpp +++ b/watchX/src/watchX.cpp @@ -19,7 +19,7 @@ #include "menu.h" #include "battery.h" -#include "diag.h" +#include "torch.h" #include "altitude.h" #include "pressure.h" #include "temperature.h" @@ -71,7 +71,7 @@ int main(void) //BMP280 bmp280; int16_t ac[7]; unsigned char animation_offsetY=0; - unsigned char mbuf[1024]; + volatile uint8_t animating=1; const uint8_t melody[]={NOTE_B0}; //volatile uint8_t mpuIsReady=1; @@ -194,6 +194,8 @@ watchMode=0; void gotoMenu( ){ stopSqw(); + + menuspeed=0; menuapp=0; nextUIFunc=drawMenus; @@ -271,15 +273,14 @@ void gotoBlueTooth(){ // } } -void gotoDiagnostic(){ +void gotoTorch(){ stopSqw(); - if(animation_offsetY==0) - if( (~SW1_WASPUSHED)&SW1_PUSHED){ - functions[uiFunc]=drawDiag; + + functions[uiFunc]=drawTorch; functions[sw1Func]=gotoMenu; functions[sw2Func]=NULL; functions[sw3Func]=NULL; - } + } @@ -396,6 +397,8 @@ anmof+=(64-anmof)/16+1; functions[uiFunc]=nextUIFunc; nextUIFunc=NULL; startSqw(); + digitalWrite(13,LOW); + digitalWrite(6,LOW); return; } diff --git a/watchX/src/watchX.h b/watchX/src/watchX.h index 3dda5e6..1ab8d6b 100644 --- a/watchX/src/watchX.h +++ b/watchX/src/watchX.h @@ -105,7 +105,7 @@ void gotoMenu( ); void gotoWatchFace( ); void gotoGyroFace( ); -void gotoDiagnostic(); +void gotoTorch(); void gotoStopWatch( ); void gotoBlueTooth( ); void gotoSettings( );