Jump to content

So in a nutshell, I'm trying to post to a Laravel page with an ESP-12E. The only response I get is "419". Which would mean a "Status Unknown" if I know my error codes of a webserver. I'm not sure what I'm doing wrong here.

Code of the Laravel page:

<?php

Route::any('hubapi', function () {
	Debugbar::disable();
    echo "hubapi";
	
});

Route::any('hubapi/tempsend', function () {
	Debugbar::disable();
    echo "tempsend";
	echo "<pre>";
	print_r($_POST);
	
	echo "</pre>";
});

?>

Code of my ESP-12E

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <String.h>
#include <ArduinoOTA.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <NTPClient.h>
#include <Time.h>
#include <TimeLib.h>
#include <Timezone.h>

const char* ssid = "----";
const char* password = "----";

const char* HTHub = "10.1.0.5";

int powerUpTime = 0;
int powerUpTimer = 0;

WiFiServer server(80);


const int button_01 = D6;
const int button_02 = D7;
const int button_03 = D8;
int button_01State = 0;
int button_02State = 0;
int button_03State = 0;

float dagtemperatuur = 21;
float nachttemperatuur = 18;
float huidigetemperatuur = 0;
long lasttempupdate = 0;

long lastblink = 0;

int screenswitch = 0;
long screenswitchtime = 0;
long unixtime = 0;

int display_mid_count = 0;

String testlog = "";

char hostName[64] = "THERMO";
uint8_t MAC_array[6];
char MAC_char[18];
char * deblank(char *str)
{
  char *out = str, *put = str;

  for (; *str != '\0'; ++str)
  {
    if (*str != ':') {
      *put++ = *str;
    }
  }
  *put = '\0';

  return out;
}

char* CreateHostname(char MAC_Adress[]) {
  int len = strlen(MAC_Adress);

  char* newname = strcat(hostName, deblank(MAC_Adress));
  //return newname;
}

#define OLED_RESET LED_BUILTIN
Adafruit_SSD1306 display(OLED_RESET);

// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS D4

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

#define SSD1306_LCDHEIGHT 64
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif


// Define NTP properties
#define NTP_OFFSET   60 * 60      // In seconds
#define NTP_INTERVAL 60 * 1000    // In miliseconds
#define NTP_ADDRESS  "0.nl.pool.ntp.org"  // change this to whatever pool is closest (see ntp.org)
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, NTP_ADDRESS, NTP_OFFSET, NTP_INTERVAL);

String date;
String t;
const char * days[] = {"Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"} ;
const char * months[] = {"Jan", "Feb", "Mrt", "Apr", "Mei", "Juni", "Juli", "Aug", "Sep", "Okt", "Nov", "Dec"} ;
const char * ampm[] = {"AM", "PM"} ;




void setup()   {
  Serial.begin(9600);
  pinMode(button_01, INPUT);
  pinMode(button_02, INPUT);
  pinMode(button_03, INPUT);
  timeClient.begin();
  Serial.println("Booting");
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3D (for the 128x64)
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.print("Connecting to Wifi...");
  display.display();
  Serial.println("Initializing WiFi");
  WiFi.mode(WIFI_STA);
  Serial.println("Generating Hostname");
  WiFi.macAddress(MAC_array);
  for (int i = 0; i < sizeof(MAC_array); ++i) {
    sprintf(MAC_char, "%s%02x:", MAC_char, MAC_array[i]);
  }
  CreateHostname(MAC_char);
  Serial.println("Your host name is: ");
  Serial.print(hostName);
  WiFi.hostname(hostName);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }
  // Port defaults to 8266
  ArduinoOTA.setPort(8266);

  // Hostname defaults to esp8266-[ChipID]
  ArduinoOTA.setHostname(hostName);

  // No authentication by default
  ArduinoOTA.setPassword((const char *)"----");

  ArduinoOTA.onStart([]() {
    Serial.println("Start");
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  });
  ArduinoOTA.begin();
  display.println("Wifi Connected");
  display.print(WiFi.localIP());
  display.display();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  sensors.begin();
  // Clear the buffer.
  delay(1000);
  display.clearDisplay();
  server.begin();
}
void display_top(int uurtijd) {
  if (screenswitch == 0) {
    if (uurtijd < 7 || uurtijd > 22) {
      display.setTextColor(BLACK, WHITE);
      display.print("N:");
      display.print(nachttemperatuur);
      display.print(" C |");
      display.setTextColor(WHITE, BLACK);
      display.print(" D:");
      display.print(dagtemperatuur);
      display.print(" C\n\r");
      display.setTextColor(WHITE, BLACK);
    } else {
      display.setTextColor(WHITE);
      display.print("N:");
      display.print(nachttemperatuur);
      display.print(" C |");
      display.setTextColor(BLACK, WHITE);
      display.print(" D:");
      display.print(dagtemperatuur);
      display.print(" C\n\r");
      display.setTextColor(WHITE, BLACK);
    }
  } else if (screenswitch == 1) {
    display.setTextColor(WHITE);
    display.setTextSize(1);
    display.println("Dag Temperatuur");
  } else if (screenswitch == 2) {
    display.setTextColor(WHITE);
    display.setTextSize(1);
    display.println("Nacht Temperatuur");
  } else if (screenswitch == 10) {
    display.setTextColor(WHITE);
    display.setTextSize(1);
    display.print(huidigetemperatuur);
    display.print(" ");
    display.print((char)247);
    display.println("C");
  }
}
void display_mid(String t) {
  if (screenswitch == 0) {

    display_currenttemp();
  } else if (screenswitch == 1) {
    display.setTextSize(2);
    blink_timer();
    display.print(dagtemperatuur);
    display.print(" ");
    display.print((char)247);
    display.println("C");
    display.setTextColor(WHITE);
    display.setTextSize(1);
  } else if (screenswitch == 2) {
    display.setTextSize(2);
    blink_timer();
    display.print(nachttemperatuur);
    display.print(" ");
    display.print((char)247);
    display.println("C");
    display.setTextColor(WHITE);
    display.setTextSize(1);
  } else if (screenswitch == 10) {
    display.setTextSize(2);
    display.println(t);
    display.setTextColor(WHITE);
    display.setTextSize(1);
  }
}

void display_bot(String t) {
  if (screenswitch == 0) {
    display.setTextSize(1);
    blink_timer();
    display.println(t);
    display.setTextColor(WHITE);
    display.setTextSize(1);
  } else if (screenswitch == 1) {
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.println("07:00 - 23:00");
    display.setTextColor(WHITE);
    display.setTextSize(1);
  } else if (screenswitch == 2) {
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.println("21:01 - 6:59");
    display.setTextColor(WHITE);
    display.setTextSize(1);
  } else if (screenswitch == 10) {
    /* display.setTextSize(1);
      display.setTextColor(WHITE);
      display.print(huidigetemperatuur);
      display.print(" ");
      display.print((char)247);
      display.println("C");*/
  }
}

void display_currenttemp() {
  updatetemps();
  display.setTextColor(WHITE, BLACK);
  display.setTextSize(2);
  display.print(huidigetemperatuur);
  display.print(" ");
  display.print((char)247);
  display.println("C");
  display.setTextSize(1);
}


void display_timer() {
  if (screenswitch != 10) {
    if (screenswitchtime + 15 <= unixtime && screenswitch != 0) {
      screenswitch = 0;
      screenswitchtime = unixtime;
    } else {
      if (screenswitchtime == 0) {
        screenswitchtime = unixtime;
      }
      if (screenswitchtime + 30 <= unixtime) {
        screenswitch = 10;
        screenswitchtime = unixtime;
      }
    }
  } else {
    if (screenswitchtime + 300 <= unixtime) {
      screenswitch = 0;
      screenswitchtime = unixtime;
    }
  }
}

void updatetemps() {
  /*float huidigetemperatuur = 0;
    long lasttempupdate = 0;*/

  if (lasttempupdate + 5 < unixtime) {
    sensors.requestTemperatures();
    huidigetemperatuur = sensors.getTempCByIndex(0);
    lasttempupdate = unixtime;

  }
}

void blink_timer() {
  /*long lastblink = 0;*/
  if (lastblink < unixtime) {
    if (display_mid_count == 0) {
      display_mid_count = 1;
    } else {
      display_mid_count = 0;
    }
    lastblink = unixtime;
  }

  if (display_mid_count == 0) {
    display.setTextColor(WHITE);
  }
  if (display_mid_count == 1) {
    display.setTextColor(BLACK);
  }

}
void button_functions() {
  if (button_01State == HIGH) {
    button01_function();
  }
  if (button_02State == HIGH) {
    button02_function();
  }
  if (button_03State == HIGH) {
    button03_function();
  }
}

void button01_function() {
  if (screenswitch < 2) {
    screenswitch++;
    screenswitchtime = unixtime;
    delay(500);
  } else {
    screenswitch = 0;
    screenswitchtime = unixtime;
    delay(500);
  }
}

void button02_function() {
  if (screenswitch == 1) {
    screenswitchtime = unixtime;
    dagtemperatuur = dagtemperatuur - 0.5;
    delay(500);
  }
  if (screenswitch == 2) {
    screenswitchtime = unixtime;
    nachttemperatuur = nachttemperatuur - 0.5;
    delay(500);
  }

}

void button03_function() {
  if (screenswitch == 1) {
    screenswitchtime = unixtime;
    dagtemperatuur = dagtemperatuur + 0.5;
    delay(500);
  }
  if (screenswitch == 2) {
    screenswitchtime = unixtime;
    nachttemperatuur = nachttemperatuur + 0.5;
    delay(500);
  }
}
void timeHandler() {

}
void loop() {
  ArduinoOTA.handle();

  date = "";
  t = "";

  timeClient.update();
  unsigned long epochTime =  timeClient.getEpochTime();
  // convert received time stamp to time_t object
  time_t local, utc;
  utc = epochTime;
  unixtime = utc;
  if (powerUpTime == 0) {
    powerUpTime = unixtime;
  }
  powerUpTimer = unixtime - powerUpTime;


  // Then convert the UTC UNIX timestamp to local time
  TimeChangeRule usEDT = {"EDT", Second, Sun, Mar, 2, +0};  //UTC - 5 hours - change this as needed
  TimeChangeRule usEST = {"EST", First, Sun, Nov, 2, +0};   //UTC - 6 hours - change this as needed
  Timezone usEastern(usEDT, usEST);
  local = usEastern.toLocal(utc);

  // now format the Time variables into strings with proper names for month, day etc
  date += days[weekday(local) - 1];
  date += ", ";
  date += day(local);
  date += " ";
  date += months[month(local) - 1];
  date += ", ";
  date += year(local);

  // format the time to 12-hour format with AM/PM and no seconds
  t += hour(local);
  t += ":";
  if (minute(local) < 10) // add a zero if minute is under 10
    t += "0";
  t += minute(local);

  button_01State = digitalRead(button_01);
  button_02State = digitalRead(button_02);
  button_03State = digitalRead(button_03);

  button_functions();

  display.clearDisplay();
  display_timer();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display_top(hour(local));
  display_mid(t);
  display_bot(t);
  display.print(t);
  display.print(" - ");
  display.print(powerUpTimer);
  display.display();

  WiFiClient client = server.available();
  if (!client) {
    return;
  } else {
    Serial.println("Somebody has connected");
  }
  String request = client.readStringUntil('\r');


if (request.indexOf("/restartesp") != -1){
    dagtemperatuur = dagtemperatuur - 0.5;
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "\r\n<title>";
    page += hostName;
    page += " - Temp Control </title>";
    page += "</head>\r\n<body>";
    page += "<p><script type=\"text/javascript\">window.location.href = \"/\"</script></p>\r\n";
    page += "</body>\r\n</html>\n\r";
    client.flush();
    client.print(page);
    ESP.restart();
  } else
  if (request.indexOf("/posttemp") != -1){
    HTTPClient http; //Declare object of class HTTPClient
   
   http.begin("http://10.1.0.5/hubapi"); //Specify request destination
   http.addHeader("Content-Type", "text/html"); //Specify content-type header
   int httpCode = http.POST("Hallo Wereld!"); //Send the request
   String payload = http.getString();  //Get the response payload
 
   Serial.println(httpCode); //Print HTTP return code
   Serial.println(payload); //Print request response payload
 
   http.end();  //Close connection
    
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "\r\n<title>";
    page += hostName;
    page += " - Temp Control </title>";
    page += "</head>\r\n<body>";
    page += "<p><script type=\"text/javascript\">window.location.href = \"/\"</script></p>\r\n";
    page += "</body>\r\n</html>\n\r";
    client.flush();
    client.print(page);

    
  } else
  if (request.indexOf("/dagmin") != -1){
    dagtemperatuur = dagtemperatuur - 0.5;
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "\r\n<title>";
    page += hostName;
    page += " - Temp Control </title>";
    page += "</head>\r\n<body>";
    page += "<p><script type=\"text/javascript\">window.location.href = \"/\"</script></p>\r\n";
    page += "</body>\r\n</html>\n\r";
    client.flush();
    client.print(page);
  } else
  if(request.indexOf("/dagplus") != -1){
    dagtemperatuur = dagtemperatuur + 0.5;
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "<head>\r\n\r\n<title>";
    page += hostName;
    page += " - Temp Control </title>";
    page += "</head>\r\n<body>";
    page += "<p><script type=\"text/javascript\">window.location.href = \"/\"</script></p>\r\n";
    page += "</body>\r\n</html>\n\r";
    client.flush();
    client.print(page);
  } else

  if (request.indexOf("/uptime") != -1) {
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "<head>\r\n<META HTTP-EQUIV=\"refresh\" CONTENT=\"5\">\r\n<title>";
    page += hostName;
    page += " - Temp Control </title></head>\r\n<body>";
    page += "<p>Uptime Timer: " + String(unixtime - powerUpTime) + "</p>\r\n";
    page += "</body>\r\n</html>\n\r";

    client.flush();
    client.print(page);
    delay(500);
  } else {

    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "<head>\r\n<META HTTP-EQUIV=\"refresh\" CONTENT=\"5\">\r\n<title>";
    page += hostName;
    page += " - Temp Control </title></head>\r\n<body>";
    page += "<p>Dag Temp:" + String(dagtemperatuur) + " Nacht Temp: " + String(nachttemperatuur) + " </p>\r\n";
    page += "<p>Huidige Temperatuur:" + String(huidigetemperatuur) + "</p>\r\n";
    page += "<p>Tijd volgens ESP:" + String(t) + "</p>\r\n";
    page += "<p>Dag Temperatuur aanpassen:<br/>\r\n <a href=\"/dagmin\"><input type=\"button\" value=\"-\"></a> - <a href=\"/dagplus\"><input type=\"button\" value=\"+\"></a></p>\r\n";
    page += "<p>Request: " + String(request) + "</p>\r\n";
    page += "<p><a href=\"/posttemp\"><input type=\"button\" value=\"POST Temp test\"></a></p>\r\n";
    page += "<p>Last POST test:</p>";
    page += "<pre>";
    page += String(testlog);
    page += "</pre>";
    page += "<p><a href=\"/restartesp\"><input type=\"button\" value=\"RESTART ESP\"></a></p>\r\n";
    page += "</body>\r\n</html>\n\r";

    client.flush();
    client.print(page);
    delay(500);

  }

  
  if (powerUpTimer >= 3600) {
    ESP.restart();

  }
}

If the ESP code is to long, here is the part I actually call the page with a post "Hallo Wereld" (Dutch for Hello World)

 

if (request.indexOf("/posttemp") != -1){
    HTTPClient http; //Declare object of class HTTPClient
   
   http.begin("http://10.1.0.5/hubapi"); //Specify request destination
   http.addHeader("Content-Type", "text/html"); //Specify content-type header
   int httpCode = http.POST("Hallo Wereld!"); //Send the request
   String payload = http.getString();  //Get the response payload
 
   Serial.println(httpCode); //Print HTTP return code
   Serial.println(payload); //Print request response payload
 
   http.end();  //Close connection
    
    String page = "HTTP/1.1 200 OK\r\n";
    page += "Content-type: text/html\r\n\r\n";
    page += "<!DOCTYPE HTML>\r\n<html>\r\n";
    page += "\r\n<title>";
    page += hostName;
    page += " - Temp Control </title>";
    page += "</head>\r\n<body>";
    page += "<p><script type=\"text/javascript\">window.location.href = \"/\"</script></p>\r\n";
    page += "</body>\r\n</html>\n\r";
    client.flush();
    client.print(page);

    
  } else

Thanks in advance!

Main RIG: i7 4770k ~ 4.8Ghz | Intel HD Onboard (enough for my LoL gaming) | Samsung 960 Pro 256GB NVMe | 32GB (4x 8GB) Kingston Savage 2133Mhz DDR3 | MSI Z97 Gaming 7 | ThermalTake FrioOCK | MS-Tech (puke) 700W | Windows 10 64Bit

Mining RIG: AMD A6-9500 | ASRock AB350 Pro | 4GB DDR4 | 500GB 2.5 Inch HDD | 2x MSI AERO GTX 1060 6GB (Core/Memory/TDP/Avg Temp +160/+800/120%/45c) | 1x Asus Strix GTX 970 (+195/+400/125%/55c) | 1x KFA2 GTX 960 (+220/+500/120%/70c) | Corsair GS800 800W | HP HSTNS-PD05 1000W | (Modded) Inter-Tech IPC 4U-4129-N Rackmount Case

Guest RIG: FX6300 | AMD HD7870 | Kingston HyperX 128GB SSD | 16GB (2x 8GB) G.Skill Ripjaws 1600Mhz DDR3 | Some ASRock 970 Mobo | Stock Heatsink | some left over PSU  | Windows 10 64Bit

VM Server: HP Proliant DL160 G6 | 2x Intel Xeon E5620 @ 2.4Ghz 4c/8t (8c/16t total) | 16GB (8x 2GB) HP 1066Mhz ECC DDR3 | 2x Western Digital Black 250GB HDD | VMWare ESXI

Storage Node: 2x Intel Xeon E5520 @ 2.27Ghz 4c/8t (8c/16t total) | Intel ServerBoard S5500HCV | 36GB (9x 4GB) 1333Mhz ECC DDR3 | 3x Seagate 2TB 7200RPM | 4x Western Digital Caviar Green 2TB

Link to comment
https://linustechtips.com/topic/881176-esp8266-httpclient-post-read-page-laravel/
Share on other sites

Link to post
Share on other sites

You should not echo in any route!

 

Return a response object (or string, array)

<?php

Route::get('/',function(){

  return 'My Response';
  
  /* Will get converted to a json response! */
  return ['key'=>'value'];
  return response()->json(['key'=>'value'])
  
  /* Return a response object with a status code (200 here) */
  return response('content',200);
  
  /* Use A view */
  return view('template',['data']);

});

 

Business Management Student @ University St. Gallen (Switzerland)

HomeServer: i7 4930k - GTX 1070ti - ASUS Rampage IV Gene - 32Gb Ram

Laptop: MacBook Pro Retina 15" 2018

Operating Systems (Virtualised using VMware): Windows Pro 10, Cent OS 7

Occupation: Software Engineer

Link to post
Share on other sites

16 minutes ago, leodaniel said:

You should not echo in any route!

 

Return a response object (or string, array)


<?php

Route::get('/',function(){

  return 'My Response';
  
  /* Will get converted to a json response! */
  return ['key'=>'value'];
  return response()->json(['key'=>'value'])
  
  /* Return a response object with a status code (200 here) */
  return response('content',200);
  
  /* Use A view */
  return view('template',['data']);

});

 

Changed it to a 'return', but it doesn't solve the problem. The echo is only there for testing purposes.

Main RIG: i7 4770k ~ 4.8Ghz | Intel HD Onboard (enough for my LoL gaming) | Samsung 960 Pro 256GB NVMe | 32GB (4x 8GB) Kingston Savage 2133Mhz DDR3 | MSI Z97 Gaming 7 | ThermalTake FrioOCK | MS-Tech (puke) 700W | Windows 10 64Bit

Mining RIG: AMD A6-9500 | ASRock AB350 Pro | 4GB DDR4 | 500GB 2.5 Inch HDD | 2x MSI AERO GTX 1060 6GB (Core/Memory/TDP/Avg Temp +160/+800/120%/45c) | 1x Asus Strix GTX 970 (+195/+400/125%/55c) | 1x KFA2 GTX 960 (+220/+500/120%/70c) | Corsair GS800 800W | HP HSTNS-PD05 1000W | (Modded) Inter-Tech IPC 4U-4129-N Rackmount Case

Guest RIG: FX6300 | AMD HD7870 | Kingston HyperX 128GB SSD | 16GB (2x 8GB) G.Skill Ripjaws 1600Mhz DDR3 | Some ASRock 970 Mobo | Stock Heatsink | some left over PSU  | Windows 10 64Bit

VM Server: HP Proliant DL160 G6 | 2x Intel Xeon E5620 @ 2.4Ghz 4c/8t (8c/16t total) | 16GB (8x 2GB) HP 1066Mhz ECC DDR3 | 2x Western Digital Black 250GB HDD | VMWare ESXI

Storage Node: 2x Intel Xeon E5520 @ 2.27Ghz 4c/8t (8c/16t total) | Intel ServerBoard S5500HCV | 36GB (9x 4GB) 1333Mhz ECC DDR3 | 3x Seagate 2TB 7200RPM | 4x Western Digital Caviar Green 2TB

Link to post
Share on other sites

@Aelita Sophie Some observations about the ESP-12E code after a quick glance:

  • CreateHostname returns nothing (return statement commented out) while the function is supposed to return a char pointer. (Undefined behavior, can corrupt the stack)

  • Defines like '#define NTP_OFFSET 60 * 60' are dangerous, change to '(60 * 60)'. The preprocessor will literally insert the defined string where the macro is used, possibly leading to math expressions not behaving like you'd think they should. Or change from macro to a const int.

  • 'sprintf(MAC_char, "%s%02x:", MAC_char, MAC_array);' Using overlapping buffers for destination and source results in undefined behavior.

     

Link to post
Share on other sites

30 minutes ago, Unimportant said:

@Aelita Sophie Some observations about the ESP-12E code after a quick glance:

  • CreateHostname returns nothing (return statement commented out) while the function is supposed to return a char pointer. (Undefined behavior, can corrupt the stack)

  • Defines like '#define NTP_OFFSET 60 * 60' are dangerous, change to '(60 * 60)'. The preprocessor will literally insert the defined string where the macro is used, possibly leading to math expressions not behaving like you'd think they should. Or change from macro to a const int.

  • 'sprintf(MAC_char, "%s%02x:", MAC_char, MAC_array);' Using overlapping buffers for destination and source results in undefined behavior.

     

I'll make those adjustments. Do you have any idea though, what the issue with posting to the webpage is?

Main RIG: i7 4770k ~ 4.8Ghz | Intel HD Onboard (enough for my LoL gaming) | Samsung 960 Pro 256GB NVMe | 32GB (4x 8GB) Kingston Savage 2133Mhz DDR3 | MSI Z97 Gaming 7 | ThermalTake FrioOCK | MS-Tech (puke) 700W | Windows 10 64Bit

Mining RIG: AMD A6-9500 | ASRock AB350 Pro | 4GB DDR4 | 500GB 2.5 Inch HDD | 2x MSI AERO GTX 1060 6GB (Core/Memory/TDP/Avg Temp +160/+800/120%/45c) | 1x Asus Strix GTX 970 (+195/+400/125%/55c) | 1x KFA2 GTX 960 (+220/+500/120%/70c) | Corsair GS800 800W | HP HSTNS-PD05 1000W | (Modded) Inter-Tech IPC 4U-4129-N Rackmount Case

Guest RIG: FX6300 | AMD HD7870 | Kingston HyperX 128GB SSD | 16GB (2x 8GB) G.Skill Ripjaws 1600Mhz DDR3 | Some ASRock 970 Mobo | Stock Heatsink | some left over PSU  | Windows 10 64Bit

VM Server: HP Proliant DL160 G6 | 2x Intel Xeon E5620 @ 2.4Ghz 4c/8t (8c/16t total) | 16GB (8x 2GB) HP 1066Mhz ECC DDR3 | 2x Western Digital Black 250GB HDD | VMWare ESXI

Storage Node: 2x Intel Xeon E5520 @ 2.27Ghz 4c/8t (8c/16t total) | Intel ServerBoard S5500HCV | 36GB (9x 4GB) 1333Mhz ECC DDR3 | 3x Seagate 2TB 7200RPM | 4x Western Digital Caviar Green 2TB

Link to post
Share on other sites

Problem still exists. Little bump ^^

Main RIG: i7 4770k ~ 4.8Ghz | Intel HD Onboard (enough for my LoL gaming) | Samsung 960 Pro 256GB NVMe | 32GB (4x 8GB) Kingston Savage 2133Mhz DDR3 | MSI Z97 Gaming 7 | ThermalTake FrioOCK | MS-Tech (puke) 700W | Windows 10 64Bit

Mining RIG: AMD A6-9500 | ASRock AB350 Pro | 4GB DDR4 | 500GB 2.5 Inch HDD | 2x MSI AERO GTX 1060 6GB (Core/Memory/TDP/Avg Temp +160/+800/120%/45c) | 1x Asus Strix GTX 970 (+195/+400/125%/55c) | 1x KFA2 GTX 960 (+220/+500/120%/70c) | Corsair GS800 800W | HP HSTNS-PD05 1000W | (Modded) Inter-Tech IPC 4U-4129-N Rackmount Case

Guest RIG: FX6300 | AMD HD7870 | Kingston HyperX 128GB SSD | 16GB (2x 8GB) G.Skill Ripjaws 1600Mhz DDR3 | Some ASRock 970 Mobo | Stock Heatsink | some left over PSU  | Windows 10 64Bit

VM Server: HP Proliant DL160 G6 | 2x Intel Xeon E5620 @ 2.4Ghz 4c/8t (8c/16t total) | 16GB (8x 2GB) HP 1066Mhz ECC DDR3 | 2x Western Digital Black 250GB HDD | VMWare ESXI

Storage Node: 2x Intel Xeon E5520 @ 2.27Ghz 4c/8t (8c/16t total) | Intel ServerBoard S5500HCV | 36GB (9x 4GB) 1333Mhz ECC DDR3 | 3x Seagate 2TB 7200RPM | 4x Western Digital Caviar Green 2TB

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×