コード例 #1
0
ファイル: web.cpp プロジェクト: egisz/sprinklers_pi
static void JSONZones(const KVPairs & key_value_pairs, FILE * stream_file)
{
	ServeHeader(stream_file, 200, "OK", false, "text/plain");
	fprintf_P(stream_file, PSTR("{\n\"zones\" : [\n"));
	FullZone zone = {0};
	for (int i = 0; i < NUM_ZONES; i++)
	{
		LoadZone(i, &zone);
		fprintf_P(stream_file, PSTR("%s\t{\"name\" : \"%s\", \"enabled\" : \"%s\", \"pump\" : \"%s\", \"state\" : \"%s\" }"), (i == 0) ? "" : ",\n", zone.name,
				zone.bEnabled ? "on" : "off", zone.bPump ? "on" : "off", isZoneOn(i + 1) ? "on" : "off");
	}
	fprintf(stream_file, "\n]}");
}
コード例 #2
0
 // Print station bits
void OSLocalUI::lcd_print_station(byte line, char c) {

  lcd.setCursor(0, line);
  if (display_board == 0) {
    lcd_print_pgm(PSTR("MC:"));  // Master controller is display as 'MC'
  }
  else {
    lcd_print_pgm(PSTR("E"));
    lcd.print((int)display_board);
    lcd_print_pgm(PSTR(":"));   // extension boards are displayed as E1, E2...
  }

  if (!GetRunSchedules() && (ActiveZoneNum() == -1) ) {    // "disabled" banner is displayed when schedules are disabled AND there are no currently running zones (to account for manual runs)
    lcd_print_line_clear_pgm(PSTR("-Disabled!-"), 1);
  }
  else {
    for (byte s=0; s<8; s++) {
      lcd.print(isZoneOn(1+s+display_board*8) ? (char)c : '_');    // note zone number correction - zones are numbered from 1.
    }
  }
  lcd_print_pgm(PSTR("    "));
  lcd.setCursor(15, 1);
  lcd.write(nntpTimeServer.GetNetworkStatus()?0:1);
}