src/main.cpp
// draw moonphase and sunrise/set and moonrise/set
draw moonphase and sunrise/set and moonrise/set
draw moonphase and sunrise / set and moonrise / set
void drawAstronomy()
{
  gfx.setFont(MoonPhases_Regular_36);
  gfx.setColor(MINI_WHITE);
  gfx.setTextAlignment(TEXT_ALIGN_CENTER);
  gfx.drawString(tft.width() / 2, 275, String((char)(97 + (moonData.illumination * 26))));
  gfx.setColor(MINI_WHITE);
  gfx.setFont(ArialRoundedMTBold_14);
  gfx.setTextAlignment(TEXT_ALIGN_CENTER);
  gfx.setColor(MINI_YELLOW);
  gfx.drawString(tft.width() / 2, 250, MOON_PHASES[moonData.phase]);
  gfx.setTextAlignment(TEXT_ALIGN_LEFT);
  gfx.setColor(MINI_YELLOW);
  gfx.drawString(5, 250, SUN_MOON_TEXT[0]);
  gfx.setColor(MINI_WHITE);
  time_t time = currentWeather.sunrise;
  gfx.drawString(5, 276, SUN_MOON_TEXT[1] + ":");
  gfx.drawString(45, 276, getTime(&time));
  time = currentWeather.sunset;
  gfx.drawString(5, 291, SUN_MOON_TEXT[2] + ":");
  gfx.drawString(45, 291, getTime(&time));
  gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
  gfx.setColor(MINI_YELLOW);
  gfx.drawString(tft.width() - 5, 250, SUN_MOON_TEXT[3]);
  gfx.setColor(MINI_WHITE);
  float lunarMonth = 29.53;
  gfx.drawString(tft.width() - 5, 276, String(moonData.phase <= 4 ? lunarMonth * moonData.illumination / 2.0 : lunarMonth - moonData.illumination * lunarMonth / 2.0, 1) + "d");
  gfx.drawString(tft.width() - 5, 291, String(moonData.illumination * 100, 0) + "%");
  gfx.drawString(tft.width() - 45, 276, SUN_MOON_TEXT[4] + ":");
  gfx.drawString(tft.width() - 45, 291, SUN_MOON_TEXT[5] + ":");
}
void drawAstronomy ( ) { gfx . setFont ( MoonPhases_Regular_36 ) ; gfx . setColor ( MINI_WHITE ) ; gfx . setTextAlignment ( TEXT_ALIGN_CENTER ) ; gfx . drawString ( tft . width ( ) / 2 , 275 , String ( ( char ) ( 97 + ( moonData . illumination * 26 ) ) ) ) ; gfx . setColor ( MINI_WHITE ) ; gfx . setFont ( ArialRoundedMTBold_14 ) ; gfx . setTextAlignment ( TEXT_ALIGN_CENTER ) ; gfx . setColor ( MINI_YELLOW ) ; gfx . drawString ( tft . width ( ) / 2 , 250 , MOON_PHASES [ moonData . phase ] ) ; gfx . setTextAlignment ( TEXT_ALIGN_LEFT ) ; gfx . setColor ( MINI_YELLOW ) ; gfx . drawString ( 5 , 250 , SUN_MOON_TEXT [ 0 ] ) ; gfx . setColor ( MINI_WHITE ) ; time_t time = currentWeather . sunrise ; gfx . drawString ( 5 , 276 , SUN_MOON_TEXT [ 1 ] + " " ) ; gfx . drawString ( 45 , 276 , getTime ( & time ) ) ; time = currentWeather . sunset ; gfx . drawString ( 5 , 291 , SUN_MOON_TEXT [ 2 ] + " " ) ; gfx . drawString ( 45 , 291 , getTime ( & time ) ) ; gfx . setTextAlignment ( TEXT_ALIGN_RIGHT ) ; gfx . setColor ( MINI_YELLOW ) ; gfx . drawString ( tft . width ( ) - 5 , 250 , SUN_MOON_TEXT [ 3 ] ) ; gfx . setColor ( MINI_WHITE ) ; float lunarMonth = 29.53 ; gfx . drawString ( tft . width ( ) - 5 , 276 , String ( moonData . phase <= 4 ? lunarMonth * moonData . illumination / 2.0 : lunarMonth - moonData . illumination * lunarMonth / 2.0 , 1 ) + " " ) ; gfx . drawString ( tft . width ( ) - 5 , 291 , String ( moonData . illumination * 100 , 0 ) + " " ) ; gfx . drawString ( tft . width ( ) - 45 , 276 , SUN_MOON_TEXT [ 4 ] + " " ) ; gfx . drawString ( tft . width ( ) - 45 , 291 , SUN_MOON_TEXT [ 5 ] + " " ) ; }
draw moonphase and sunrise/set and moonrise/set
draw moonphase and sunrise / set and moonrise / set
// approximate moon age