Skip to content

Commit 2bf81a0

Browse files
Move config to wifisetup.h.
1 parent 34c3cf4 commit 2bf81a0

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

smartMeterLogger-esp32.ino

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#define SH1106_OLED /* uncomment to compile for SH1106 instead of SSD1306 */
2-
31
#include <SD.h>
42
#include <FS.h>
53
#include <driver/uart.h>
@@ -18,28 +16,13 @@
1816
#include <SSD1306.h> /* In same library as SH1106 */
1917
#endif
2018

21-
#define USE_WS_BRIDGE true /* true = connect to a dsmr websocket bridge - false = connect to a dsmr smartmeter */
22-
23-
const char* WS_BRIDGE_HOST = "192.168.0.106"; /* bridge adress */
24-
const uint16_t WS_BRIDGE_PORT = 80; /* bridge port */
25-
const char* WS_BRIDGE_URL = "/raw"; /* bridge url */
26-
2719
#define SAVE_TIME_MIN (1) /* data save interval in minutes */
2820

2921
/* settings for smartMeter */
3022
#define RXD_PIN (36)
3123
#define BAUDRATE (115200)
3224
#define UART_NR (UART_NUM_2)
3325

34-
/* settings for a ssd1306/sh1106 oled screen */
35-
#define OLED_ADDRESS (0x3C)
36-
#define I2C_SDA_PIN (21)
37-
#define I2C_SCL_PIN (22)
38-
39-
/* settings for ntp time sync */
40-
const char* NTP_POOL = "nl.pool.ntp.org";
41-
const char* TIMEZONE = "CET-1CEST,M3.5.0/2,M10.5.0/3"; /* Central European Time - see http://www.remotemonitoringsystems.ca/time-zone-abbreviations.php */
42-
4326
const char* WS_RAW_URL = "/raw";
4427
const char* WS_EVENTS_URL = "/events";
4528

@@ -109,7 +92,7 @@ void setup() {
10992
/* check if oled display is present */
11093
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN);
11194
Wire.beginTransmission(OLED_ADDRESS);
112-
uint8_t error = Wire.endTransmission();
95+
const uint8_t error = Wire.endTransmission();
11396
if (error)
11497
Serial.println("no SSD1306/SH1106 oled found.");
11598
else {

wifisetup.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1+
#define SH1106_OLED /* uncomment to compile for SH1106 instead of SSD1306 */
2+
13
const char* WIFI_NETWORK = "xxx";
24
const char* WIFI_PASSWORD = "xxx";
35

6+
#define USE_WS_BRIDGE true /* true = connect to a dsmr websocket bridge - false = connect to a dsmr smartmeter */
7+
8+
const char* WS_BRIDGE_HOST = "192.168.0.106"; /* bridge name or ip*/
9+
const uint16_t WS_BRIDGE_PORT = 80; /* bridge port */
10+
const char* WS_BRIDGE_URL = "/raw"; /* bridge url */
11+
412
#define SET_STATIC_IP false /* If SET_STATIC_IP is set to true then STATIC_IP, GATEWAY, SUBNET and PRIMARY_DNS have to be set to some sane values */
513

614
const IPAddress STATIC_IP(192, 168, 0, 90); /* This should be outside your router dhcp range! */
715
const IPAddress GATEWAY(192, 168, 0, 1); /* Set to your gateway ip address */
816
const IPAddress SUBNET(255, 255, 255, 0); /* Usually 255,255,255,0 check in your router or pc connected to the same network */
917
const IPAddress PRIMARY_DNS(192, 168, 0, 30); /* Check in your router */
1018
const IPAddress SECONDARY_DNS(192, 168, 0, 50); /* Check in your router */
19+
20+
/* settings for ntp time sync */
21+
const char* NTP_POOL = "nl.pool.ntp.org";
22+
const char* TIMEZONE = "CET-1CEST,M3.5.0/2,M10.5.0/3"; /* Central European Time - see http://www.remotemonitoringsystems.ca/time-zone-abbreviations.php */
23+
24+
/* settings for a ssd1306/sh1106 oled screen */
25+
#define OLED_ADDRESS (0x3C)
26+
#define I2C_SDA_PIN (21)
27+
#define I2C_SCL_PIN (22)

0 commit comments

Comments
 (0)