Example #1
0
Payload Status::getStatusPayload()
{
    Payload s;
    writeHex(s.motor, 5, motor.getCurrentPosition());
    writeHex(s.motorState, 1, motor.isMoving() ? 1 : 0);

    writeTemp(s.scopeTemp, scopeTemp.lastValue);
    writeTemp(s.extTemp, meteoTemp.lastTemperature());
    writeHum(s.extHum, meteoTemp.lastHumidity());

    writeVolt(s.battery, voltmeter.lastValue());
    writeHex(s.heater, 2, resistor.pct);
    writeHex(s.filterwheel, 5, filterWheelMotor.getCurrentPosition());
    s.filterwheelState = filterWheelMotor.getProtocolStatus();
    return s;
}
Example #2
0
// Update the display
void ClockMaster::updateDisplayTime(DateTime time_now){
  clearTextLine(secondXPos, secondYPos, secondSize, secondLength);
  writeSecond(time_now);

  clearTextLine(tempXPos, tempYPos, tempSize, tempLength);
  writeTemp();

  // If second is 0, change the minute aswell
  if (time_now.second() == 0) {
    clearTextLine(minuteXPos, minuteYPos, minuteSize, minuteLength);
    writeMinute(time_now);

    // If the second is 0 AND minute is 0, bump the hour up
    if (time_now.minute() == 0) {
      clearTextLine(hourXPos, hourYPos, hourSize, hourLength);
      writeHour(time_now);

      // If the second is 0 AND the minute is 0 AND the hour is 0, skip to next day
      if (time_now.hour() == 0) {
        clearTextLine(dayXPos, dayYPos, daySize, dayLength);
        clearTextLine(weekdayXPos, weekdayYPos, weekdaySize, weekdayLength);
        writeDay(time_now);
        writeWeekDay(time_now);

        // If the second is 0 AND the minute is 0 AND the hour is 0 AND the day is 1, skip to next day (preferebly friday at 6pm)
        if (time_now.day() == 1) {
          clearTextLine(monthXPos, monthYPos, monthSize, monthLength);
          writeMonth(time_now);

          // If the second is 0 AND the minute is 0 AND the hour is 0 AND the day is 1 AND the month is 1, skip to next year and RIDE YOUR HOVERBOARDS
          if (time_now.month() == 1) {
            clearTextLine(yearXPos, yearYPos, yearSize, yearLength);
            writeYear(time_now);
          }
        }
      }
    }
  }
}
Example #3
0
// reset the display
void ClockMaster::resetDisplayTime(DateTime newTime, int currentXPos){

  clearTextLine(secondXPos, secondYPos, secondSize, secondLength);
  writeSecond(newTime);

  clearTextLine(minuteXPos, minuteYPos, minuteSize, minuteLength);
  writeMinute(newTime);

  clearTextLine(hourXPos, hourYPos, hourSize, hourLength);
  writeHour(newTime);

  clearTextLine(dayXPos, dayYPos, daySize, dayLength);
  clearTextLine(weekdayXPos, weekdayYPos, weekdaySize, weekdayLength);
  writeDay(newTime);
  writeWeekDay(newTime);

  clearTextLine(monthXPos, monthYPos, monthSize, monthLength);
  writeMonth(newTime);

  clearTextLine(yearXPos, yearYPos, yearSize, yearLength);
  writeYear(newTime);

  clearTextLine(tempXPos, tempYPos, tempSize, tempLength);
  writeTemp();

  // draw current x-position-indicator
  if(lastAlarmXPos != currentXPos){
    // Center x-position-indicator under current number being changed
    clearTextLine(0, 85, 2, 160);
    if(currentXPos != -1){
      int calculatedXPos = 45 * currentXPos + 30;
      tft.setCursor(calculatedXPos, 85);
      tft.print("-");
    }
  }

  lastAlarmXPos = currentXPos;
}