Browse Source

First commit

master
Torsten Stauder 5 years ago
commit
458ad94684
  1. 5
      .gitignore
  2. 67
      .travis.yml
  3. 7
      .vscode/extensions.json
  4. 39
      include/README
  5. 46
      lib/README
  6. 25
      platformio.ini
  7. 128
      src/logmessages.h
  8. 2494
      src/main.cpp
  9. 11
      test/README

5
.gitignore

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

67
.travis.yml

@ -0,0 +1,67 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < https://docs.platformio.org/page/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < https://docs.platformio.org/page/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < https://docs.platformio.org/page/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio run
#
# Template #2: The project is intended to be used as a library with examples.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
# - platformio update
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N

7
.vscode/extensions.json

@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

39
include/README

@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html

46
lib/README

@ -0,0 +1,46 @@
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c
and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>
int main (void)
{
...
}
```
PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.
More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html

25
platformio.ini

@ -0,0 +1,25 @@
;PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
lib_deps =
https://github.com/schreibfaul1/ESP32-audioI2S#master
https://github.com/madhephaestus/ESP32Encoder#master
https://github.com/knolleary/pubsubclient#master
https://github.com/biologist79/ESP32FTPServer
https://github.com/FastLED/FastLED#master
https://github.com/me-no-dev/ESPAsyncWebServer#master
https://github.com/biologist79/rfid#master
;https://github.com/bblanchon/ArduinoJson#master

128
src/logmessages.h

@ -0,0 +1,128 @@
static const char stillOnlineMqtt[] PROGMEM = "MQTT: Bin noch online.";
static const char tryConnectMqttS[] PROGMEM = "Versuche Verbindung zu MQTT-Broker aufzubauen";
static const char mqttOk[] PROGMEM = "MQTT-Session aufgebaut.";
static const char sleepTimerEOP[] PROGMEM = "Sleep-Timer: Nach dem letzten Track der Playlist.";
static const char sleepTimerEOT[] PROGMEM = "Sleep-Timer: Nach dem Ende des laufenden Tracks.";
static const char sleepTimerStop[] PROGMEM = "Sleep-Timer wurde deaktiviert.";
static const char sleepTimerAlreadyStopped[] PROGMEM = "Sleep-Timer ist bereits deaktiviert.";
static const char sleepTimerSetTo[] PROGMEM = "Sleep-Timer gesetzt auf";
static const char allowButtons[] PROGMEM = "Alle Tasten werden freigegeben.";
static const char lockButtons[] PROGMEM = "Alle Tasten werden gesperrt.";
static const char noPlaylistNotAllowedMqtt[] PROGMEM = "Playmode kann nicht auf 'Keine Playlist' gesetzt werden via MQTT.";
static const char playmodeChangedMQtt[] PROGMEM = "Playmode per MQTT angepasst.";
static const char noPlaymodeChangeIfIdle[] PROGMEM = "Playmode kann nicht verändert werden, wenn keine Playlist aktiv ist.";
static const char noValidTopic[] PROGMEM = "Kein gültiges Topic";
static const char freePtr[] PROGMEM = "Ptr-Freigabe";
static const char freeMemory[] PROGMEM = "Freier Speicher";
static const char freeMemoryAfterFree[] PROGMEM = "Freier Speicher nach Aufräumen";
static const char releaseMemoryOfOldPlaylist[] PROGMEM = "Gebe Speicher der alten Playlist frei.";
static const char dirOrFileDoesNotExist[] PROGMEM = "Datei oder Verzeichnis existiert nicht!";
static const char unableToAllocateMemForPlaylist[] PROGMEM = "Speicher für Playlist konnte nicht allokiert werden!";
static const char unableToAllocateMem[] PROGMEM = "Speicher konnte nicht allokiert werden!";
static const char fileModeDetected[] PROGMEM = "Dateimodus erkannt.";
static const char nameOfFileFound[] PROGMEM = "Gefundenes File";
static const char reallocCalled[] PROGMEM = "Speicher reallokiert.";
static const char unableToAllocateMemForLinearPlaylist[] PROGMEM = "Speicher für lineare Playlist konnte nicht allokiert werden!";
static const char numberOfValidFiles[] PROGMEM = "Anzahl gültiger Files";
static const char newLoudnessReceivedQueue[] PROGMEM = "Neue Lautstärke empfangen via Queue";
static const char newCntrlReceivedQueue[] PROGMEM = "Kontroll-Kommando empfangen via Queue";
static const char newPlaylistReceived[] PROGMEM = "Neue Playlist empfangen";
static const char repeatTrackDueToPlaymode[] PROGMEM = "Wiederhole Titel aufgrund von Playmode.";
static const char repeatPlaylistDueToPlaymode[] PROGMEM = "Wiederhole Playlist aufgrund von Playmode.";
static const char cmndStop[] PROGMEM = "Kommando: Stop";
static const char cmndPause[] PROGMEM = "Kommando: Pause";
static const char cmndNextTrack[] PROGMEM = "Kommando: Nächster Titel";
static const char cmndPrevTrack[] PROGMEM = "Kommando: Vorheriger Titel";
static const char cmndFirstTrack[] PROGMEM = "Kommando: Erster Titel von Playlist";
static const char cmndLastTrack[] PROGMEM = "Kommando: Letzter Titel von Playlist";
static const char cmndDoesNotExist[] PROGMEM = "Dieses Kommando existiert nicht.";
static const char lastTrackAlreadyActive[] PROGMEM = "Es wird bereits der letzte Track gespielt.";
static const char firstTrackAlreadyActive[] PROGMEM = "Es wird bereits der erste Track gespielt.";
static const char trackStartAudiobook[] PROGMEM = "Titel wird im Hörspielmodus von vorne gespielt.";
static const char trackStart[] PROGMEM = "Titel wird von vorne gespielt.";
static const char trackChangeWebstream[] PROGMEM = "Im Webradio-Modus kann nicht an den Anfang gesprungen werden.";
static const char endOfPlaylistReached[] PROGMEM = "Ende der Playlist erreicht.";
static const char trackStartatPos[] PROGMEM = "Titel wird abgespielt ab Position";
static const char rfidScannerReady[] PROGMEM = "RFID-Tags koennen jetzt gescannt werden...";
static const char rfidTagDetected[] PROGMEM = "RFID-Karte erkannt: ";
static const char rfidTagReceived[] PROGMEM = "RFID-Karte empfangen: ";
static const char rfidTagUnknownInNvs[] PROGMEM = "RFID-Karte ist im NVS nicht hinterlegt.";
static const char goToSleepDueToIdle[] PROGMEM = "Gehe in Deep Sleep wegen Inaktivität...";
static const char goToSleepDueToTimer[] PROGMEM = "Gehe in Deep Sleep wegen Sleep Timer...";
static const char goToSleepNow[] PROGMEM = "Gehe jetzt in Deep Sleep!";
static const char maxLoudnessReached[] PROGMEM = "Maximale Lautstärke bereits erreicht!";
static const char minLoudnessReached[] PROGMEM = "Minimale Lautstärke bereits erreicht!";
static const char errorOccured[] PROGMEM = "Fehler aufgetreten!";
static const char noMp3FilesInDir[] PROGMEM = "Verzeichnis beinhaltet keine mp3-Files.";
static const char modeSingleTrack[] PROGMEM = "Modus: Einzelner Track";
static const char modeSingleTrackLoop[] PROGMEM = "Modus: Einzelner Track in Endlosschleife";
static const char modeSingleAudiobook[] PROGMEM = "Modus: Hoerspiel";
static const char modeSingleAudiobookLoop[] PROGMEM = "Modus: Hoerspiel in Endlosschleife";
static const char modeAllTrackAlphSorted[] PROGMEM = "Modus: Spiele alle Tracks (alphabetisch sortiert) des Ordners";
static const char modeAllTrackRandom[] PROGMEM = "Modus: Alle Tracks eines Ordners zufällig";
static const char modeAllTrackAlphSortedLoop[] PROGMEM = "Modus: Alle Tracks eines Ordners sortiert (alphabetisch) in Endlosschleife";
static const char modeAllTrackRandomLoop[] PROGMEM = "Modus: Alle Tracks eines Ordners zufällig in Endlosschleife";
static const char modeWebstream[] PROGMEM = "Modus: Webstream";
static const char webstreamNotAvailable[] PROGMEM = "Aktuell kein Webstream möglich, da keine WLAN-Verbindung vorhanden!";
static const char modeDoesNotExist[] PROGMEM = "Abspielmodus existiert nicht!";
static const char modeRepeatNone[] PROGMEM = "Repeatmodus: Kein Repeat";
static const char modeRepeatTrack[] PROGMEM = "Repeatmodus: Aktueller Titel";
static const char modeRepeatPlaylist[] PROGMEM = "Repeatmodus: Gesamte Playlist";
static const char modeRepeatTracknPlaylist[] PROGMEM = "Repeatmodus: Track und Playlist";
static const char modificatorAllButtonsLocked[] PROGMEM = "Modifikator: Alle Tasten werden per RFID gesperrt.";
static const char modificatorAllButtonsUnlocked[] PROGMEM = "Modifikator: Alle Tasten werden per RFID freigegeben.";
static const char modificatorSleepd[] PROGMEM = "Modifikator: Sleep-Timer wieder deaktiviert.";
static const char modificatorSleepTimer15[] PROGMEM = "Modifikator: Sleep-Timer per RFID aktiviert (15 Minuten).";
static const char modificatorSleepTimer30[] PROGMEM = "Modifikator: Sleep-Timer per RFID aktiviert (30 Minuten).";
static const char modificatorSleepTimer60[] PROGMEM = "Modifikator: Sleep-Timer per RFID aktiviert (60 Minuten).";
static const char modificatorSleepTimer120[] PROGMEM = "Modifikator: Sleep-Timer per RFID aktiviert (2 Stunden).";
static const char ledsDimmedToNightmode[] PROGMEM = "LEDs wurden auf Nachtmodus gedimmt.";
static const char modificatorNotallowedWhenIdle[] PROGMEM = "Modifikator kann bei nicht aktivierter Playlist nicht angewendet werden.";
static const char modificatorSleepAtEOT[] PROGMEM = "Modifikator: Sleep-Timer am Ende des Titels aktiviert.";
static const char modificatorSleepAtEOTd[] PROGMEM = "Modifikator: Sleep-Timer am Ende des Titels deaktiviert.";
static const char modificatorSleepAtEOP[] PROGMEM = "Modifikator: Sleep-Timer am Ende der Playlist aktiviert.";
static const char modificatorSleepAtEOPd[] PROGMEM = "Modifikator: Sleep-Timer am Ende der Playlist deaktiviert.";
static const char modificatorAllTrackAlphSortedLoop[] PROGMEM = "Modifikator: Alle Titel (alphabetisch sortiert) in Endlosschleife.";
static const char modificatorAllTrackRandomLoop[] PROGMEM = "Modifikator: Alle Titel (zufällige Reihenfolge) in Endlosschleife.";
static const char modificatorCurTrackLoop[] PROGMEM = "Modifikator: Aktueller Titel in Endlosschleife.";
static const char modificatorCurAudiobookLoop[] PROGMEM = "Modifikator: Aktuelles Hörspiel in Endlosschleife.";
static const char modificatorPlaylistLoopActive[] PROGMEM = "Modifikator: Alle Titel in Endlosschleife aktiviert.";
static const char modificatorPlaylistLoopDeactive[] PROGMEM = "Modifikator: Alle Titel in Endlosschleife deaktiviert.";
static const char modificatorTrackActive[] PROGMEM = "Modifikator: Titel in Endlosschleife aktiviert.";
static const char modificatorTrackDeactive[] PROGMEM = "Modifikator: Titel in Endlosschleife deaktiviert.";
static const char modificatorNotAllowed[] PROGMEM = "Modifikator konnte nicht angewendet werden.";
static const char modificatorLoopRev[] PROGMEM = "Modifikator: Endlosschleife beendet.";
static const char modificatorDoesNotExist[] PROGMEM = "Ein Karten-Modifikator existiert nicht vom Typ";
static const char errorOccuredNvs[] PROGMEM = "Es ist ein Fehler aufgetreten beim Lesen aus dem NVS!";
static const char statementsReceivedByServer[] PROGMEM = "Vom Server wurde Folgendes empfangen";
static const char savedSsidInNvs[] PROGMEM = "Speichere SSID in NVS";
static const char savedWifiPwdInNvs[] PROGMEM = "Speichere WLAN-Password in NVS";
static const char apReady[] PROGMEM = "Access-Point geöffnet";
static const char httpReady[] PROGMEM = "HTTP-Server gestartet.";
static const char unableToMountSd[] PROGMEM = "SD-Karte konnte nicht gemountet werden.";
static const char unableToCreateVolQ[] PROGMEM = "Konnte Volume-Queue nicht anlegen.";
static const char unableToCreateRfidQ[] PROGMEM = "Konnte RFID-Queue nicht anlegen.";
static const char unableToCreateMgmtQ[] PROGMEM = "Konnte Play-Management-Queue nicht anlegen.";
static const char unableToCreatePlayQ[] PROGMEM = "Konnte Track-Queue nicht anlegen..";
static const char initialBrightnessfromNvs[] PROGMEM = "Initiale LED-Helligkeit wurde aus NVS geladen";
static const char wroteInitialBrightnessToNvs[] PROGMEM = "Initiale LED-Helligkeit wurde ins NVS geschrieben.";
static const char loadedInitialBrightnessForNmFromNvs[] PROGMEM = "LED-Helligkeit für Nachtmodus wurde aus NVS geladen";
static const char wroteNmBrightnessToNvs[] PROGMEM = "LED-Helligkeit für Nachtmodus wurde ins NVS geschrieben.";
static const char wroteFtpUserToNvs[] PROGMEM = "FTP-User wurde ins NVS geschrieben.";
static const char loadedFtpUserFromNvs[] PROGMEM = "FTP-User wurde aus NVS geladen";
static const char wroteFtpPwdToNvs[] PROGMEM = "FTP-Passwort wurde ins NVS geschrieben.";
static const char loadedFtpPwdFromNvs[] PROGMEM = "FTP-Passwort wurde aus NVS geladen";
static const char loadedMaxInactivityFromNvs[] PROGMEM = "Maximale Inaktivitätszeit wurde aus NVS geladen";
static const char wroteMaxInactivityToNvs[] PROGMEM = "Maximale Inaktivitätszeit wurde ins NVS geschrieben.";
static const char loadedInitialLoudnessFromNvs[] PROGMEM = "Initiale Lautstärke wurde aus NVS geladen";
static const char wroteInitialLoudnessToNvs[] PROGMEM = "Initiale Lautstärke wurde ins NVS geschrieben.";
static const char loadedMaxLoudnessFromNvs[] PROGMEM = "Maximale Lautstärke wurde aus NVS geladen";
static const char wroteMaxLoudnessToNvs[] PROGMEM = "Maximale Lautstärke wurde ins NVS geschrieben.";
static const char wroteMqttFlagToNvs[] PROGMEM = "MQTT-Flag wurde ins NVS geschrieben.";
static const char loadedMqttActiveFromNvs[] PROGMEM = "MQTT-Flag (aktiviert) wurde aus NVS geladen";
static const char loadedMqttDeactiveFromNvs[] PROGMEM = "MQTT-Flag (deaktiviert) wurde aus NVS geladen";
static const char wroteMqttServerToNvs[] PROGMEM = "MQTT-Server wurde ins NVS geschrieben.";
static const char loadedMqttServerFromNvs[] PROGMEM = "MQTT-Server wurde aus NVS geladen";
static const char ssidNotFoundInNvs[] PROGMEM = "SSID wurde im NVS nicht gefunden.";
static const char wifiPwdNotFoundInNvs[] PROGMEM = "WLAN-Passwort wurde im NVS nicht gefunden.";
static const char mqttConnFailed[] PROGMEM = "Verbindung fehlgeschlagen, versuche erneut in Kürze erneut";

2494
src/main.cpp
File diff suppressed because it is too large
View File

11
test/README

@ -0,0 +1,11 @@
This directory is intended for PIO Unit Testing and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html
Loading…
Cancel
Save