Browse Source

Add README.md file to firmware

Florian Eitel 1 year ago
parent
commit
d383677b80
No account linked to committer's email address
2 changed files with 61 additions and 31 deletions
  1. 61
    0
      firmware/README.md
  2. 0
    31
      firmware/firmware.ino

+ 61
- 0
firmware/README.md View File

@@ -0,0 +1,61 @@
1
+# øko weatherstatiøn firmware
2
+
3
+## How to get started with Arduino
4
+
5
+https://git.okoyono.de/oko/weatherstation/wiki#flashing-the-firmware
6
+
7
+* Install Arduino IDE: https://www.arduino.cc/en/Guide/HomePage#install
8
+* Install ESP in Arduino IDE board manager: https://github.com/esp8266/Arduino#installing-with-boards-manager
9
+* Select `LOLIN(WEMOS) D1 R2 & mini` as Board
10
+* Set Sketch location (File -> Preferences -> Sketchbook Location) to this folder (not `libraries/`)
11
+* Copy `user_config.h` and adjust the values
12
+
13
+## FAQ
14
+
15
+### Why bundle external libs?
16
+
17
+We decided to put these libs inside the project folder, because we have a lot
18
+of issues with finding the right libs (some libs need a specific version, some
19
+libs have no unique name, some libs are broken, ...). This is not a fine
20
+software engineering practice, but it was too much of a hassle to get this
21
+right, so we decided to put everything in version control. This way, we also
22
+can control the version of the lib, which makes the build process of this
23
+project more robust to changes.
24
+
25
+You can update the libs using the Arduino IDE.
26
+
27
+### How to fix error: Can't find file `config_user.h`?
28
+
29
+If you compile the source code and it can't find this file, this is intentional
30
+:) You need to create a `config_user.h` with your own settings. Use the
31
+`config_user.h.example` as a starting point.
32
+
33
+### How to fix java exception on Serial Port open?
34
+
35
+That can happen with openjdk 8. Try a newer openjdk version (>9)
36
+
37
+### How can I add a new Sensor?
38
+
39
+* Create a file `sensor_$sensorname.ino`
40
+* Add flag to `config_user.h` (don't forget to update `config_user.h.example`
41
+* Add initialization method of sensor (should be named `sensor_$sensorname_begin()` to `setup()` in `firmware.ino` guarded with preprocessor flag
42
+* Create method without parameters returning a float and safe function reference into `sensors` array
43
+
44
+### Whats wrong with all the NaN's?
45
+
46
+If a sensor does not produce a value the sensor value is Not a Number (`NaN`).
47
+InfluxDB client will filter NaN values before sending the data.
48
+
49
+`nanf()` returns a `float NaN`. The argument can be used by library
50
+implementations to distinguish different NaN values in a
51
+implementation-specific manner.
52
+
53
+## Wishlist
54
+
55
+- Webserver for /metrics endpoint (Prometheus)
56
+- Push sensor values to various 3rd party services (https://openweathermap.org/, http://www.weewx.com/)
57
+- MQTT
58
+- Buffer sensor values if there is no WIFI connection
59
+- Configure weather station over http web interface
60
+- OTA firmware update
61
+- evaluate https://sminghub.github.io/Sming/about/ or https://github.com/marvinroger/homie-esp8266

+ 0
- 31
firmware/firmware.ino View File

@@ -5,47 +5,16 @@
5 5
 #include <DNSServer.h>
6 6
 #include <ESP8266WebServer.h>
7 7
 
8
-// External libs
9
-// We decided to put these libs inside the project folder, because we have a lot
10
-// of issues with finding the right libs (some libs need a specific version, some
11
-// libs have no unique name, some libs are broken, ...). This is not a fine
12
-// software engineering practice, but it was too much of a hassle to get this right,
13
-// so we decided to put everything in version control. This way, we also can control
14
-// the version of the lib, which makes the build process of this project more
15
-// robust to changes.
16
-// IMPORTANT: You need to set the sketch location of your Arduino IDE to the firmware
17
-// folder in order to use the libs. (File -> Preferences -> Sketchbook Location)
18 8
 #include <WiFiClient.h>          // WiFiClient
19 9
 #include <WiFiManager.h>         // WiFiManager
20 10
 
21 11
 // Project includes
22 12
 #include "config.h"
23 13
 
24
-// IMPORTANT: If you compile the sourcecode and it can't find this file, this is
25
-// intentional :) You need to create a config_user.h with your own settings. Use the
26
-// config_user.h.example as a starting point.
27 14
 #include "config_user.h"
28 15
 
29 16
 //*************************************************************************//
30 17
 
31
-/**
32
- * Whishlist:
33
- * - Webserver for /metrics endpoint (Prometheus)
34
- * - Show current sensor values over simple webpage
35
- * - Push sensor values to various 3rd party services (https://openweathermap.org/)
36
- * - MQTT?
37
- *
38
- * - Buffer sensor values if there is no WIFI connection
39
- * - Configure weather station over http webinterface
40
- * - OTA firmware update
41
- *
42
- * TODO:
43
- * - https://sminghub.github.io/Sming/about/
44
- * - https://github.com/marvinroger/homie-esp8266
45
- */
46
-
47
-//*************************************************************************//
48
-
49 18
 const uint8_t VALUES = 8;
50 19
 float currentSensorData[VALUES] = {nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value"), nanf("no value")};
51 20
 float (*sensors[VALUES])() = {};

Loading…
Cancel
Save