/************************ * * This file contains the html code for the webpage served by the ethernet module. The webpage shows the state and conditions * of the inputs as well as the analog values. * *************************/ /******************** * Function to serve the webpage showing the interlock system status * *********************/ void serve_webpage(void) { String condition_txt; switch (currentState) { case 0: condition_txt = "Rebooting..."; break; case 1: condition_txt = "normal"; break; case 2: condition_txt = "Cage Door Trip"; break; case 3: condition_txt = "Vacuum Trip"; break; case 4: condition_txt = "Source Trip"; break; } EthernetClient client = server.available(); if (client) { //Serial.println("new client"); // an http request ends with a blank line boolean currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); //Serial.write(c); // if you've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); // the connection will be closed after completion of the response client.println("Refresh: 5"); // refresh the page automatically every 5 sec client.println(); client.println(""); client.println(""); client.println(""); client.println(" Multi-SNICS Interlock Status Display"); client.println(" "); client.println(""); client.println(""); client.println("

Multi-SNICS Interlock Status Display

"); client.print("

Condition: "); client.print(condition_txt); client.println("

"); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println(" "); client.println(" "); client.print(" "); client.println(" "); client.print(" "); client.println(" "); client.println(" "); client.println("
Input ConditionsOutput RelaysMeasurements
Reset Switch: "); client.print((input[0]==input_normal[0]) ? "normal" : "TRIPPED"); client.println("Switch LED: "); client.print((output[0]==0) ? "Off" : "Flashing Red"); client.println("Tritium Detector: "); client.print(tSniffer, 1); client.println(" uCi/m^3
Emergency Interlock Switch: "); client.print((input[1]==input_normal[1]) ? "normal" : "TRIPPED"); client.println("Buzzer: "); client.print((output[1]==1) ? "Buzzing" : "Off"); client.println("Vacuum Gauge: "); client.print(vacuum); client.println("E-6 Torr
Cage Door Contact: "); client.print((input[2]==input_normal[2]) ? "normal" : "TRIPPED"); client.println("Cage Door Trip LED: "); client.print((output[2]==0) ? "Green/Off" : "Red"); client.println("Titanium Sublimation Pump: "); client.print(subPump, 1); client.println(" Amps
Fume Hood Flow Switch: "); client.print((input[3]==input_normal[3]) ? "normal" : "TRIPPED"); client.println("Vacuum Trip LED: "); client.print((output[3]==0) ? "Green/Off" : "Red"); client.println("
Vacuum Condition - Ground: "); client.print((input[4]==input_normal[4]) ? "normal" : "TRIPPED"); client.println("Source Trip LED: "); client.print((output[4]==0) ? "Green/Off" : "Red"); client.println("
Tritium Detector: "); client.print((input[5]==input_normal[5]) ? "normal" : "TRIPPED"); client.println("Pre-accelerator Power Supply: "); client.print((output[5]==1) ? "Unlocked" : "Locked Out"); client.println("
UNUSED"); client.print((input[6]==input_normal[6]) ? "normal" : "TRIPPED"); client.println("Gate Valve - Ground: "); client.print((output[6]==1) ? "Open" : "Closed"); client.println("
Building Power Failure: "); client.print((input[7]==input_normal[7]) ? "normal" : "TRIPPED"); client.println("Gate Valve - Mid Potential: "); client.print((output[7]==1) ? "Open" : "Closed"); client.println("
Coolant Flow At Pump: "); client.print((input[8]==input_normal[8]) ? "normal" : "TRIPPED"); client.println("UNUSED"); client.print((output[8]==0) ? "Open" : "Closed"); client.println("
Vacuum Condition - Mid Potential: "); client.print((input[9]==input_normal[9]) ? "normal" : "TRIPPED"); client.println("UNUSED"); client.print((output[9]==0) ? "Open" : "Closed"); client.println("
UNUSED"); client.print((input[10]==input_normal[10]) ? "normal" : "TRIPPED"); client.println("UNUSED"); client.print((output[10]==0) ? "Open" : "Closed"); client.println("
Coolant Flow At Source: "); client.print((input[11]==input_normal[11]) ? "normal" : "TRIPPED"); client.println("UNUSED"); client.print((output[11]==0) ? "Open" : "Closed"); client.println("
Smoke Detector At Source: "); client.print((input[12]==input_normal[12]) ? "normal" : "TRIPPED"); client.println("UNUSED"); client.print((output[12]==0) ? "Open" : "Closed"); client.println("
UNUSED"); client.print((input[13]==input_normal[13]) ? "normal" : "TRIPPED"); client.println("High-voltage Power Supplies: "); client.print((output[13]==1) ? "Unlocked" : "Locked Out"); client.println("
UNUSED"); client.print((input[14]==input_normal[14]) ? "normal" : "TRIPPED"); client.println("Boiler: "); client.print((output[14]==1) ? "Unlocked" : "Locked Out"); client.println("
UNUSED"); client.print((input[15]==input_normal[15]) ? "normal" : "TRIPPED"); client.println("Ionizer: "); client.print((output[15]==1) ? "Unlocked" : "Locked Out"); client.println("
"); client.println("
"); client.println(""); client.println(""); break; } if (c == '\n') { // you're starting a new line currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } // give the web browser time to receive the data delay(1); // close the connection: client.stop(); //Serial.println("client disconnected"); } }