Commit 9fe899db authored by Eric Duminil's avatar Eric Duminil
Browse files

Merge branch 'refactor/src_folder' into develop

parents e48ddf50 79e8d26b
......@@ -38,16 +38,6 @@ namespace ntp {
}
}
void resetAmpel() {
Serial.print(F("Resetting"));
#ifdef AMPEL_CSV
FS_LIB.end();
#endif
LedEffects::LEDsOff();
delay(1000);
ESP.restart();
}
uint32_t max_loop_duration = 0;
//FIXME: Remove every instance of Strings, to avoid heap fragmentation problems. (Start: "Free heap space : 17104 bytes")
......
......@@ -2,19 +2,17 @@
#define AMPEL_UTIL_H_INCLUDED
#include <Arduino.h>
#include "config.h"
#include "wifi_util.h" // To get MAC
#ifdef AMPEL_CSV
# include "csv_writer.h" // To close filesystem before reset
#endif
#include <WiFiUdp.h> //required for NTP
#include <WiFiUdp.h> // required for NTP
#include "src/lib/NTPClient-master/NTPClient.h" // NTP
#if defined(ESP8266)
# define BOARD "ESP8266"
# include <ESP8266WiFi.h> // required to get MAC address
# define get_free_heap_size() system_get_free_heap_size()
#elif defined(ESP32)
# define BOARD "ESP32"
# include <WiFi.h> // required to get MAC address
# define get_free_heap_size() esp_get_free_heap_size()
#else
# define BOARD "Unknown"
......@@ -42,6 +40,4 @@ namespace util {
extern uint32_t max_loop_duration;
const extern String SENSOR_ID;
void resetAmpel();
#endif
......@@ -16,7 +16,7 @@ namespace config {
void WiFiConnect(const String &hostname) {
//NOTE: WiFi Multi could allow multiple SSID and passwords.
WiFi.persistent(false); // Don't write user & password to Flash.
WiFi.mode(WIFI_STA); // Set ESP8266 to be a WiFi-client only
WiFi.mode(WIFI_STA); // Set ESP to be a WiFi-client only
#if defined(ESP8266)
WiFi.hostname(hostname);
#elif defined(ESP32)
......@@ -29,16 +29,16 @@ void WiFiConnect(const String &hostname) {
// Wait for connection, at most wifi_timeout seconds
for (int i = 0; i <= config::wifi_timeout && (WiFi.status() != WL_CONNECTED); i++) {
LedEffects::showRainbowWheel();
led_effects::showRainbowWheel();
Serial.print(".");
}
if (WiFi.status() == WL_CONNECTED) {
LedEffects::showKITTWheel(color::green);
led_effects::showKITTWheel(color::green);
Serial.println();
Serial.print("\nWiFi connected, IP address: ");
Serial.println(WiFi.localIP());
} else {
LedEffects::showKITTWheel(color::red);
led_effects::showKITTWheel(color::red);
Serial.println("\nConnection to WiFi failed");
}
}
#ifndef WIFI_UTIL_H_INCLUDED
# define WIFI_UTIL_H_INCLUDED
# if defined(ESP8266)
# include <ESP8266WiFi.h>
# elif defined(ESP32)
# include <WiFi.h>
# endif
#define WIFI_UTIL_H_INCLUDED
#include "led_effects.h"
#include "config.h"
#include "util.h"
#include "led_effects.h"
void WiFiConnect(const String &hostname);
#endif
......@@ -8,7 +8,7 @@
; http://docs.platformio.org/page/projectconf.html
[platformio]
src_dir = ./
src_dir = ampel-firmware
[env:esp8266]
platform = espressif8266
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment