 void loop() {
   blePeripheral.poll();
   BLECentral central = blePeripheral.central();
-  
-  if(isTimeSet){
+
+  if (isTimeSet) {
     renderBackground();
     renderTime();
     renderDate();
-  } else if(!central || !central.connected()){
-    buffer.drawText("Searching...",15,8,buffer.rgb(255,255,255), &liberationSans_8ptFontInfo);
+  } else if (!central || !central.connected()) {
+    buffer.drawText("Searching...", 15, 8, buffer.rgb(255, 255, 255), &liberationSans_8ptFontInfo);
   }
 
   //temp sleep
   isSleep ? display.off() : display.on();
-  if(display.getButtons(TSButtonUpperLeft)){
+  if (display.getButtons(TSButtonUpperLeft)
+    && display.getButtons(TSButtonUpperRight)) {
     isSleep = isSleep ? 0 : 1;
     delay(250);
   }
+
   refreshScreen();
 }
 

  //Bind events for connects and disconnects.
  blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
  blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);
  
  timeCharacteristic.setEventHandler(BLEWritten, setTimeHandler);
  
  //Start BLE service.
  blePeripheral.begin();
}

#include "lib_RenderBuffer.h"
#include "lib_StringBuffer.h"

//Pinouts for TinyShield BLE.
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9

const int SCREEN_WIDTH = 48;

//Determines which version of TinyScreen we are using.
TinyScreen display = TinyScreen(TinyScreenPlus);
//Buffer used for drawing.
RenderBuffer<uint16_t, 20> buffer;
int rBackground = 0;
int gBackground = 0;
int bBackground = 0;
char isTimeSet = 0;
//Temp sleep
char isSleep = 0;

//Instantiate BLE peripheral.
BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
