 struct Forecast {
 
   time_t epoch;
+  char day[4];
   int temp_high;
   int temp_low;
   int max_wind;
   int ave_wind;
   char wind_dir[8];
+  int wind_degrees;
   int ave_humidity;
   char conditions[32];
   char icon[16];

      f.ave_wind = day["avewind"]["mph"];
    }
    f.ave_humidity = day["avehumidity"];
    strncpy(f.wind_dir, day["avewind"]["dir"], sizeof(f.wind_dir));
    strncpy(f.conditions, day["conditions"], sizeof(f.conditions));
    strncpy(f.icon, day["icon"], sizeof(f.icon));

  return 3;
}

static void display_time(time_t &epoch) {
  char buf[32];
  strftime(buf, sizeof(buf), metric? "%H:%S": "%I:%S%p", localtime(&epoch));
  tft.setCursor(centre_text(buf, tft.width()/2, 1), 109);
  tft.print(buf);
  strftime(buf, sizeof(buf), "%a %d", localtime(&epoch));
  tft.setCursor(centre_text(buf, tft.width()/2, 1), 118);
  tft.print(buf);
}

static void display_wind(int wind_degrees, int wind_speed) {
    // http://www.iquilezles.org/www/articles/sincos/sincos.htm
  int rad = tft.width()/3, cx = tft.width()/2, cy = 68;
  const float a = 0.999847695, b = 0.017452406;
  // wind dir is azimuthal angle with N at 0
  float sin = 1.0, cos = 0.0;
  for (uint16_t i = 0; i < wind_degrees; i++) {
    const float ns = a*sin + b*cos;
    const float nc = a*cos - b*sin;
    cos = nc;
    sin = ns;
  }
  // wind dir rotates clockwise so compensate
  int ex = cx-rad*cos, ey = cy-rad*sin;
  tft.fillCircle(ex, ey, 3, BLACK);
  tft.drawLine(ex, ey, ex+wind_speed*(cx-ex)/50, ey+wind_speed*(cy-ey)/50, BLACK);
}

static void display_wind_speed(int wind_speed, const char *wind_dir, const char *wind_unit) {
  tft.setTextSize(2);
  tft.setCursor(1, 1);
  tft.print(wind_speed);
  tft.setTextSize(1);
  tft.print(wind_unit);
  tft.setCursor(1, 17);
  tft.print(wind_dir);
}

static void display_temperature(int temp, int temp_min, char temp_unit) {
  tft.setTextSize(2);
  tft.setCursor(1, tft.height() - 16);
  tft.print(temp);
  tft.setTextSize(1);
  tft.print(temp_unit);
  if (temp != temp_min) {
    tft.setCursor(1, tft.height() - 24);
    tft.print(temp_min);
  }
}

static void display_humidity(int humidity) {
  tft.setTextSize(2);
  tft.setCursor(right(val_len(humidity), tft.width(), 2) - 6, tft.height() - 16);
  tft.print(humidity);
  tft.setTextSize(1);
  tft.setCursor(tft.width() - 6, tft.height() - 16);
  tft.print('%');
}

void display_weather(struct Conditions &c) {

  tft.fillScreen(WHITE);
  tft.setTextColor(BLACK);

  display_wind_speed(c.wind, c.wind_dir, c.wind_unit);

  display_temperature(c.temp, c.feelslike, c.temp_unit);

  display_humidity(c.humidity);

  tft.setTextSize(2);
  tft.setCursor(right(val_len(c.atmos_pressure), tft.width(), 2)-6*strlen(c.pres_unit), 1);
