Skip to content

Commit

Permalink
Remove slam folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sarachehab committed Jun 19, 2024
1 parent f47e817 commit 1995fd3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
6 changes: 6 additions & 0 deletions esp32/lib/WifiSetup/MqttSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ MqttSetup::MqttSetup(const char *server, int port, NTPClient &timeClient)
: server(server), port(port), client(espClient), timeClient(timeClient)
{
client.setServer(server, port);
}

void MqttSetup::setClientID()
{
String tmp_id = "Bot-" + String(BotID);
client_id = new char[tmp_id.length() + 1];
strcpy(client_id, tmp_id.c_str());
Expand All @@ -19,6 +23,8 @@ void MqttSetup::connect(unsigned long timeout)
unsigned long start = 0;
while (!client.connected() && start < timeout)
{
Serial.print("CLIENT ID:");
Serial.println(client_id);
Serial.print("Attempting MQTT connection...");
if (client.connect(client_id))
{
Expand Down
1 change: 1 addition & 0 deletions esp32/lib/WifiSetup/MqttSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MqttSetup
public:
MqttSetup(const char *server, int port, NTPClient &timeClient);
void connect(unsigned long timeout = ULONG_MAX);
void setClientID();

/**
* Loop function that takes care of the sending of messages
Expand Down
14 changes: 8 additions & 6 deletions esp32/lib/WifiSetup/WifiSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,21 @@ void WifiSetup::connect(unsigned long timeout)
// Get the WiFi signal strength
getStrength();

// Resolve RunID and BotID
if (!runIdResolved)
{
resolveId();
runIdResolved = true;
}

// Ping the MQTT server to ensure it's reachable
pingServer(mqtt.getServer());

// Setup MQTT
mqtt.setClientID();
mqtt.setCallback(callback);
mqtt.connect(timeout - start);

if (!runIdResolved)
{
resolveId();
runIdResolved = true;
}

// Setup NTP
timeClient.begin();
}
Expand Down
20 changes: 10 additions & 10 deletions esp32/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ test_ignore =
test_serial
test_battery

[env:native]
platform = native
test_ignore =
test_mpu6050
test_wifi
build_flags =
-I include
-D NATIVE
lib_ignore =
PidController
; [env:native]
; platform = native
; test_ignore =
; test_mpu6050
; test_wifi
; build_flags =
; -I include
; -D NATIVE
; lib_ignore =
; PidController
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions server/website/public/data/map_processed/map.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "map_processed/map.png",
"image": "map.png",
"resolution": 0.05,
"origin": [
-2.09,
Expand All @@ -10,7 +10,7 @@
{
"x": -0.3,
"y": -0.3,
"image": "data/incidents/incident1.jpg"
"image": "data/incidents/incident.jpg"
},
{
"x": 3,
Expand Down

0 comments on commit 1995fd3

Please sign in to comment.