Skip to content

Commit

Permalink
Changed to use Serial1 for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
roarfred committed May 2, 2016
1 parent 94ccb3b commit ac0a16e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
5 changes: 3 additions & 2 deletions PulsePort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ bool PulsePort::ReadTotalValue(int pAddress, unsigned long& pValue)
vAddress++;
EEPROM.get(vAddress, pValue);

printf("Read initial value from EEPROM: %ld", pValue);
Serial1.println("Read initial value from EEPROM: ");
Serial1.println(pValue);
vResult = true;
}
else
{
printf("Checksum didn't match. No values in EEPROM");
Serial1.println("Checksum didn't match. No values in EEPROM");
}

EEPROM.end();
Expand Down
21 changes: 11 additions & 10 deletions RealTimeClock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@ bool RealTimeClock::Update()
}
void RealTimeClock::SetupNtp()
{
printf("Connecting to NTP server");
Serial1.print("Connecting to NTP server");
while (!UpdateTime(true)) {
printf(".");
Serial1.print(".");
}
printf("\n");
Serial1.println("");
}
bool RealTimeClock::UpdateTime(bool pForceUpdate)
{
if (pForceUpdate)
{
printf("Force time update...");
Serial1.println("Force time update...");
gTimeClient->update();
if (gTimeClient->getRawTime() > 1000)
{
gLastUpdatedTime = millis();
gLastTime = gTimeClient->getRawTime();
printf("Time is ");
printf(gTimeClient->getFormattedTime().c_str());
Serial1.println("Time is ");
Serial1.println(gTimeClient->getFormattedTime().c_str());
return true;
}
else
Expand All @@ -56,20 +56,21 @@ bool RealTimeClock::UpdateTime(bool pForceUpdate)
{
if (ShouldUpdateTime())
{
printf("Updating time now...");
Serial1.println("Updating time now...");
if (!UpdateTime(true))
{
printf("Failed to update time...");
Serial1.println("Failed to update time...");
if (ShouldUpdateTime(10))
{
printf("ERROR updating time for a long time now...");
Serial1.println("ERROR updating time for a long time now...");
// It's been way too long since last update
return false;
}
}
else
{
printf("Time is %s", gTimeClient->getFormattedTime().c_str());
Serial1.println("Time is ");
Serial1.println(gTimeClient->getFormattedTime());
}
}
return true;
Expand Down
12 changes: 6 additions & 6 deletions WebConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ void WebConfig::Setup()
WiFi.softAP(AP_SSID);
WiFi.mode(WIFI_AP);

Serial.print("Configuring access point as ");
Serial.println(AP_SSID);
Serial1.println("Configuring access point as ");
Serial1.println(AP_SSID);

IPAddress vIP = WiFi.softAPIP();
Serial.print("AP IP Address: ");
Serial.println(vIP);
Serial1.println("AP IP Address: ");
Serial1.println(vIP.toString().c_str());

SetupWebServer();

Expand All @@ -40,15 +40,15 @@ void WebConfig::Setup()
void WebConfig::SetupWebServer()
{

Serial.println("Setting up web server on port 80");
Serial1.println("Setting up web server on port 80");
gWebServer.on("/", WebConfig::WebServer_GetConfig);
gWebServer.on("/save", HTTP_POST, WebConfig::WebServer_SaveConfig);
gWebServer.begin();
}

void WebConfig::WebServer_GetConfig()
{
Serial.println("Responding to HTTP request at '/'");
Serial1.println("Responding to HTTP request at '/'");
String vHtmlText = gConfigPageFunction();
gWebServer.send(200, "text/html", vHtmlText);
}
Expand Down

0 comments on commit ac0a16e

Please sign in to comment.