Skip to content

Commit

Permalink
stable with a dot in serial.println at setup . funny .
Browse files Browse the repository at this point in the history
  • Loading branch information
murataka committed Apr 4, 2018
1 parent a43ec07 commit 3b1c6ca
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
2 changes: 2 additions & 0 deletions watchX/lib/SSD1306/oled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ for( uint8_t i=0; i<sizeof(s_oled128x64_initData); i++)
}
void ssd1306_drawBuffer(byte x, byte y, byte w, byte h, const byte *buf)
{

uint8_t i, j;
// ssd1306_setRamBlock(x, y, w);
ssd1306_spiDataStart();
Expand All @@ -49,6 +50,7 @@ for( uint8_t i=0; i<sizeof(s_oled128x64_initData); i++)
// ssd1306_nextRamPage();
}
ssd1306_spiStop_hw();

}

void ssd1306_sendCommand(uint8_t command)
Expand Down
2 changes: 1 addition & 1 deletion watchX/lib/SSD1306/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#define uint unsigned int
//#define byte unsigned char
extern unsigned char mbuf[128*8];

extern uint8_t uiX,uiY;
extern unsigned char animation_offsetY;
void ssd1306_drawBuffer(byte x, byte y, byte w, byte h, const byte *buf);
Expand Down
59 changes: 36 additions & 23 deletions watchX/src/watchX.ino
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ volatile uint8_t animating=1;
unsigned char mbuf[128*8];
extern volatile uint8_t animating;
volatile unsigned long lastcolon;
unsigned long _tm=millis();
char strtmpbuf[50];

//extern volatile unsigned long lastcolon;
Expand Down Expand Up @@ -120,6 +121,25 @@ if(batterylevel<530){
}
//}
}

void gotoWatchFace(){
// if(animation_offsetY==0)
// if( (~SW1_WASPUSHED)&SW1_PUSHED){
nextUIFunc= drawWatchFace;//printWatchFace;//printWatchFace;// drawWatchFace;// printWatchFace;
functions[sw1Func]=gotoMenu; /// TODO here i am
functions[sw2Func]=NULL;
functions[sw3Func]=NULL;
// functions[ uiFunc];
// nextUIFunc=functions[ uiFunc];
// speed=4;
// sw2Func=gotoMenu;
// sw3Func=NULL;
// functions[ bleFunc] =handleBle;
functions[usbFunc]=NULL;
functions[batteryFunc]=NULL;
// functions[updateFunc]=updateThings;
// }
}
void gotoMenu( ){
//if(menuindex<2)
//menuindex=1;
Expand Down Expand Up @@ -161,24 +181,6 @@ void gotoSettings( ){
}


void gotoWatchFace(){
// if(animation_offsetY==0)
// if( (~SW1_WASPUSHED)&SW1_PUSHED){
nextUIFunc= drawWatchFace;//printWatchFace;//printWatchFace;// drawWatchFace;// printWatchFace;
functions[sw1Func]=gotoMenu; /// TODO here i am
functions[sw2Func]=NULL;
functions[sw3Func]=NULL;
// functions[ uiFunc];
// nextUIFunc=functions[ uiFunc];
// speed=4;
// sw2Func=gotoMenu;
// sw3Func=NULL;
// functions[ bleFunc] =handleBle;
functions[usbFunc]=drawUsb;
functions[batteryFunc]=drawBattery;
// functions[updateFunc]=updateThings;
// }
}
void gotoGyroFace(){
if(animation_offsetY==0)
if( (~SW1_WASPUSHED)&SW1_PUSHED){
Expand Down Expand Up @@ -336,6 +338,9 @@ setDateTime();
// gotoDiagnostic(true);
// ble_connect(); // TODO: bluetoot enable / disable
updateThings();
Serial.println("."); //// TODO: idkw serial must print something for stability.
//delay(100);
//cli();

}
//uint8_t buffer[64*128/8];
Expand All @@ -348,14 +353,19 @@ clearAll();

// ssd1306_sendCommand(SSD1306_SETSTARTLINE | (animPos) % 64);
//if(functions[uiFunc]!=NULL)
// handleFunction(functions[uiFunc]);
//handleFunction(nextUIFunc); ///// todo draw not stable !!!
animation_offsetY++;
// handleFunction(functions[uiFunc]);
//if(nextUIFunc!=NULL)
handleFunction(nextUIFunc); ///// todo draw not stable !!!
animation_offsetY+=1;
//Serial.println(".");
//delay(5);
if(animation_offsetY>=64){

animation_offsetY=0;
if(nextUIFunc!=NULL)
functions[uiFunc]=nextUIFunc;
nextUIFunc=NULL;
nextUIFunc=NULL;
return;
}

}else{
Expand Down Expand Up @@ -424,9 +434,12 @@ buttonFX(500|((DEVICESTATE&B00000111)*300));
}

digitalWrite(LED2,sound.playing()?HIGH: LOW);
drawLoop();
if(millis()-_tm>30){

_tm=millis();
}

drawLoop();



Expand Down

0 comments on commit 3b1c6ca

Please sign in to comment.