fucking fixes i hate cpp
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include <ArduinoJson.h>
|
||||
#include "HTTPClient.h"
|
||||
|
||||
HTTPClient http;
|
||||
#include <HTTPClient.h>
|
||||
|
||||
String serializeSensorValue (
|
||||
int sensorId,
|
||||
@@ -33,13 +31,16 @@ String serializeDevice (
|
||||
);
|
||||
|
||||
void deserializeSensorValue (
|
||||
HTTPClient* http,
|
||||
int httpResponseCode
|
||||
);
|
||||
|
||||
void deserializeActuatorStatus (
|
||||
HTTPClient* http,
|
||||
int httpResponseCode
|
||||
);
|
||||
|
||||
void deserializeDevice (
|
||||
HTTPClient* http,
|
||||
int httpResponseCode
|
||||
);
|
||||
@@ -6,4 +6,4 @@
|
||||
#include "test.hpp"
|
||||
#include "mqtt.hpp"
|
||||
|
||||
#define LED 2
|
||||
uint32_t getChipID();
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
String response;
|
||||
|
||||
|
||||
String serializeSensorValue(int sensorId, int deviceId, String sensorType, String unit, int sensorStatus, float temperature, float humidity, float carbonMonoxide, float lat, float lon, long timestamp)
|
||||
{
|
||||
DynamicJsonDocument doc(2048);
|
||||
@@ -59,7 +58,8 @@ String serializeDevice(int sensorId, int deviceId, String sensorType, int status
|
||||
return output;
|
||||
}
|
||||
|
||||
void deserializeSensorValue (int httpResponseCode){
|
||||
void deserializeSensorValue (HTTPClient http, int httpResponseCode)
|
||||
{
|
||||
|
||||
if (httpResponseCode > 0)
|
||||
{
|
||||
@@ -101,7 +101,8 @@ void deserializeSensorValue (int httpResponseCode){
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeActuatorStatus (int httpResponseCode){
|
||||
void deserializeActuatorStatus (HTTPClient http, int httpResponseCode)
|
||||
{
|
||||
|
||||
if (httpResponseCode > 0)
|
||||
{
|
||||
@@ -139,7 +140,8 @@ void deserializeActuatorStatus (int httpResponseCode){
|
||||
}
|
||||
}
|
||||
|
||||
void deserializeDevice (int httpResponseCode){
|
||||
void deserializeDevice (HTTPClient http, int httpResponseCode)
|
||||
{
|
||||
|
||||
if (httpResponseCode > 0)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
#include "main.hpp"
|
||||
|
||||
const uint32_t deviceId = getChipID();
|
||||
|
||||
uint32_t getChipID()
|
||||
{
|
||||
uint32_t chipId;
|
||||
for (int i = 0; i < 17; i = i + 8) {
|
||||
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
|
||||
}
|
||||
return chipId;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
// WiFi Connection
|
||||
if(setup_wifi() != 0)
|
||||
{
|
||||
Serial.print("Error connecting to WiFI");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "rest.hpp"
|
||||
|
||||
RestClient client = RestClient(SERVER_IP, SERVER_PORT);
|
||||
HTTPClient httpClient;
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include "test.hpp"
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <wifi.hpp>
|
||||
|
||||
WiFiClient espClient;
|
||||
PubSubClient client(espClient);
|
||||
WiFiClient wifiClient;
|
||||
|
||||
int setup_wifi()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user