     setTime(t);
   }
   
-  int x;
-  int y;
-  
-  int timeW = timeSegW * ((showSecs == 1) ? 6 : 4) + timeSegT * ( (showSecs == 1) ? 9 : 5); // calc. width of time output
-  int dateW = (dateSegW + dateSegT) * ((showYear) ? 10 : 5) + dateSegT; // calc. width of date output
+  uint8_t x;
+  uint8_t y;
   
   int tSec = second();
   int tMin = minute();


//#define DEBUG_SERIAL

rgb24 bgCol        = {0x00, 0x00, 0x00};  // background colour

rgb24 timeCol      = {0x2f, 0x2f, 0xff};  // time: segment colour
rgb24 timeColFx    = {0x00, 0x00, 0x1f};  // time: colour of 'non active segment' effect
rgb24 dateCol      = {0x00, 0x00, 0x9f};  // date: segment colour
rgb24 dateColFx    = {0x00, 0x00, 0x15};  // date: colour of 'non active segment' effect

// values for a 96x64 display; need to be adjusted for other resolutions
int timeSegT       = 4;  // time: thickness of a segment (in pixel)
int timeSegW       = 17; // time: length of a single segment (in pixel)
int dateSegT       = 2;  // date: thickness of a segment
int dateSegW       = 7;  // date: length of a single segment

const int showSecs = 2;  // display seconds: 0: no, 1: yes, 2: no seconds, but blinking dots
const int showYear = 0;  // show year: 0 no, 1: yes



SmartMatrix matrix;

const int timeSegH = timeSegW * 2 - timeSegT;
const int dateSegH = dateSegW * 2 - dateSegT;

byte currSec = 60;


void setup() {
  // set the Time library to use Teensy 3.x's RTC to keep time

    Serial.println();
#endif

    // start position of time segments
    if (timeStartX == 0xFF) { // auto center
      x = ( w - timeW ) / 2;
    } else {
      x = timeStartX;
    }

    y = timeStartY;
    
    x += drawNumber(x, y, tHour, timeSegW, timeSegT, 2, timeCol, timeColFx);
    x += timeSegT;
    if (showSecs != 2 || (tSec % 2) ) {
      drawBar(x, y + colonPos, timeSegT, timeSegT, 0, timeCol);
      drawBar(x, y + timeSegH - timeSegT - colonPos, timeSegT, timeSegT, 0, timeCol);
    } else {
      drawBar(x, y + colonPos, timeSegT, timeSegT, 0, timeColFx);
      drawBar(x, y + timeSegH - timeSegT - colonPos, timeSegT, timeSegT, 0, timeColFx);
    }
    x += timeSegT * 2;
    x += drawNumber(x, y, tMin, timeSegW, timeSegT, 2, timeCol, timeColFx);
    if (showSecs == 1) {
      x += timeSegT;
      drawBar(x, y + colonPos, timeSegT, timeSegT, 0, timeCol);
      drawBar(x, y + timeSegH - timeSegT - colonPos, timeSegT, timeSegT, 0, timeCol);
      x += timeSegT * 2;
      x += drawNumber(x, y, tSec, timeSegW, timeSegT, 2, timeCol, timeColFx);
    }
    y += timeSegH;
    
    // start position of time segments
    if (dateStartX == 0xFF) { // auto center
      x = ( w - dateW ) / 2;
    } else {
      x = dateStartX;
    }

    if (dateStartY == 0xFF) { // auto place
      y += (h - y - dateSegH) / 2;
    } else {
      y = dateStartY;
    }

    if (showYear) {    
      x += drawNumber(x, y, tYear, dateSegW, dateSegT, 4, dateCol, dateColFx);
