Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
murataka committed Apr 17, 2018
1 parent 9d912c3 commit 5931df9
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 42 deletions.
20 changes: 10 additions & 10 deletions watchX/lib/SSD1306/oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -17,30 +17,30 @@ 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,
// SSD1306_DISPLAYALLON_RESUME,
SSD1306_DISPLAYON
};

for( uint8_t i=0; i<sizeof(s_oled128x64_initData); i++)
{
ssd1306_sendCommand(s_oled128x64_initData[i]);
}
for( uint8_t i=0; i<sizeof(s_oled128x64_initData); i++)
{
ssd1306_sendCommand(s_oled128x64_initData[i]);
}

}
void ssd1306_drawBuffer(byte x, byte y, byte w, byte h, const byte *buf)
Expand Down
16 changes: 0 additions & 16 deletions watchX/src/diag.cpp

This file was deleted.

8 changes: 4 additions & 4 deletions watchX/src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -37,8 +37,8 @@ void menusw1( ){
case MENU_BLUETOOTH:
gotoBlueTooth();
break;
case MENU_DIAGNOSTIC:
// gotoDiagnostic();
case MENU_TORCH:
gotoTorch();

break;
case MENU_SETTINGS:
Expand Down Expand Up @@ -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 >";
Expand Down
4 changes: 2 additions & 2 deletions watchX/src/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions watchX/src/torch.cpp
Original file line number Diff line number Diff line change
@@ -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);



}
4 changes: 2 additions & 2 deletions watchX/src/diag.h → watchX/src/torch.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef DIAG_H
#define DIAG_H


void drawDiag();

void drawTorch();


#endif
17 changes: 10 additions & 7 deletions watchX/src/watchX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -194,6 +194,8 @@ watchMode=0;

void gotoMenu( ){
stopSqw();


menuspeed=0;
menuapp=0;
nextUIFunc=drawMenus;
Expand Down Expand Up @@ -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;
}

}


Expand Down Expand Up @@ -396,6 +397,8 @@ anmof+=(64-anmof)/16+1;
functions[uiFunc]=nextUIFunc;
nextUIFunc=NULL;
startSqw();
digitalWrite(13,LOW);
digitalWrite(6,LOW);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion watchX/src/watchX.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void gotoMenu( );
void gotoWatchFace( );

void gotoGyroFace( );
void gotoDiagnostic();
void gotoTorch();
void gotoStopWatch( );
void gotoBlueTooth( );
void gotoSettings( );
Expand Down

0 comments on commit 5931df9

Please sign in to comment.