void GxepdPage6()
{    display.setRotation(4);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
 display.setFont();
 display.setTextSize(1);
   DrawBattery( 0, 21);
//DrawRSSI(105, 21, wifi_signal);
  display.setTextColor(GxEPD_RED);
 clok(70, 19);
  display.setTextColor(GxEPD_BLACK);
display.drawLine(10,25, 128, 25, GxEPD_BLACK);//x1 y1 x2 y2
 DisplayForecastSection(0, 100) ;
  display.update();

   // опрос кнопок 10с перед сном
  for (int i = 0; i < 200; i++) {
  // покинуть цикл при достижении 100
  delay (100);
  if ((i == 70)||(i == 80)||(i == 90)) testSpeaker2();
  if (i == 100) break;
  bool gpio_get_level_38 = digitalRead(38);
   if (gpio_get_level_38 == 1)
       {testSpeaker();
       // Serial.println("GxepdPage4");
         GxepdPage5();
        break;
       }
     bool gpio_get_level_37 = digitalRead(37);  
      if (gpio_get_level_37 == 1)
       {testSpeaker();
       Kalendar();
      // GxepdPage6();
        break;
       }
       bool gpio_get_level_39 = digitalRead(39);  
      if (gpio_get_level_39 == 1)
       {testSpeaker();
        GxepdPage2();
        break;
       }
}
//Serial.println("END");
}



void DisplayForecastSection(int x, int y) {
  int f = 0;
 // do {
 //   DisplayForecastWeather(x, y, f);
//    f++;
//  } while (f < max_readings1);
  int r = 0;
  do { // Pre-load temporary arrays with with data - because C parses by reference and remember that[1] has already been converted to I units
    if (Units == "I") pressure_readings[r] = WxForecast[r].Pressure * 0.02953;   else pressure_readings[r] = WxForecast[r].Pressure*1000/1333;
    if (Units == "I") rain_readings[r]     = WxForecast[r].Rainfall * 0.0393701; else rain_readings[r]     = WxForecast[r].Rainfall;
    if (Units == "I") snow_readings[r]     = WxForecast[r].Snowfall * 0.0393701; else snow_readings[r]     = WxForecast[r].Snowfall;
    temperature_readings[r]                = WxForecast[r].Temperature;
    humidity_readings[r]                   = WxForecast[r].Humidity;
    r++;
  } while (r < max_readings1);
  int gwidth =100, gheight = 60;
  //int gx = (SCREEN_WIDTH - gwidth * 4) / 5 + 8;
  int gx=20;
 // int gy = (SCREEN_HEIGHT - gheight - 30);
  int gy = gheight- 15;
  int gap = gwidth + gx;
  // (x,y,width,height,MinValue, MaxValue, Title, Data Array, AutoScale, ChartMode)
 DrawGraph(gx + 0 * gap, gy, gwidth, gheight, 700, 800, Units == "M" ? TXT_PRESSURE_HPA : TXT_PRESSURE_IN, pressure_readings, max_readings1, autoscale_on, barchart_off);
 DrawGraph(gx + 0 * gap, gy+85, gwidth, gheight, 10, 30,    Units == "M" ? TXT_TEMPERATURE_C : TXT_TEMPERATURE_F, temperature_readings, max_readings1, autoscale_on, barchart_off);
//  DrawGraph(gx + 2 * gap, gy, gwidth, gheight, 0, 100,   TXT_HUMIDITY_PERCENT, humidity_readings, max_readings, autoscale_off, barchart_off);
 if (SumOfPrecip(rain_readings, max_readings1) >= SumOfPrecip(snow_readings, max_readings1))//проверка каких данных о дожде или о снеге больше и запрос соотв графика
    DrawGraph(gx + 0 * gap , gy+170, gwidth, gheight, 0, 30, Units == "M" ? TXT_RAINFALL_MM : TXT_RAINFALL_IN, rain_readings, max_readings1, autoscale_on, barchart_on);
  else
    DrawGraph(gx + 0 * gap, gy+170, gwidth, gheight, 0, 30, Units == "M" ? TXT_SNOWFALL_MM : TXT_SNOWFALL_IN, snow_readings, max_readings1, autoscale_on, barchart_on);
}

float SumOfPrecip(float DataArray[], int readings) {
  float sum = 0;
  for (int i = 0; i <= readings; i++) {
    sum += DataArray[i];
  }
  return sum;
}
