Skip to content

Commit

Permalink
Merge pull request #25 from ohAnd/develop
Browse files Browse the repository at this point in the history
releasing recent feature implementations:
- MQTT binding -> issue #11,  issue #12, issue #19 
- OLED SSH1106 support -> issue #23 
- extend the length of wifi password -> issue #10 
- stablization for OTA update -> issue #17 
- general stability

This release will be the last one with ESP8266only support. (plan) - Further releases will be compiled for ESP8266 and ESP32. (seperated firmware files)
  • Loading branch information
ohAnd authored Jun 1, 2024
2 parents f6f3b9e + 027a4ff commit 26f68d8
Show file tree
Hide file tree
Showing 16 changed files with 924 additions and 134 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,29 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: write temp file with build number and set to env variable
run: |
touch ${{ github.workspace }}/include/buildnumber.txt
printf -v BUILDNUMBER "%04d" ${{github.run_number}}
echo $BUILDNUMBER >> ${{ github.workspace }}/include/buildnumber.txt
echo "${BUILDNUMBER}_${{ steps.extract_branch.outputs.branch }}" >> ${{ github.workspace }}/include/buildnumber.txt
echo "got current buildnumber and saved: "
cat ${{ github.workspace }}/include/buildnumber.txt
echo "CURRENT_BUILDNUMBER=$BUILDNUMBER" >> $GITHUB_ENV
Expand All @@ -42,7 +47,7 @@ jobs:
mv .pio/build/esp12e/firmware.bin .pio/build/esp12e/dtuGateway_snapshot_$VERSIONNUMBER.bin
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: .pio/build/esp12e/dtuGateway_snapshot_${{ env.CURRENT_VERSIONNUMBER }}.bin

Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/feature_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: PlatformIO CI feature branch build

on:
push:
branches:
- '*'
- '!develop'
- '!main'
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO Core
run: pip install --upgrade platformio

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: write temp file with build number and set to env variable
run: |
touch ${{ github.workspace }}/include/buildnumber.txt
printf -v BUILDNUMBER "%04d" ${{github.run_number}}
echo "${BUILDNUMBER}_${{ steps.extract_branch.outputs.branch }}" >> ${{ github.workspace }}/include/buildnumber.txt
echo "got current buildnumber and saved: "
cat ${{ github.workspace }}/include/buildnumber.txt
echo "CURRENT_BUILDNUMBER=$BUILDNUMBER" >> $GITHUB_ENV
- name: Build PlatformIO Project
run: pio run

- name: got current version and changing firmware name after building
run: |
VERSIONNUMBER=$(python ${{ github.workspace }}/version_inc.py getversion 2>&1)
echo "got versionnumber: " $VERSIONNUMBER
echo "CURRENT_VERSIONNUMBER=$VERSIONNUMBER" >> $GITHUB_ENV
mv .pio/build/esp12e/firmware.bin .pio/build/esp12e/dtuGateway_snapshot_$VERSIONNUMBER.bin
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: .pio/build/esp12e/dtuGateway_snapshot_${{ env.CURRENT_VERSIONNUMBER }}.bin
8 changes: 4 additions & 4 deletions .github/workflows/main_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO Core
Expand All @@ -42,7 +42,7 @@ jobs:
mv .pio/build/esp12e/firmware.bin .pio/build/esp12e/dtuGateway_release_$VERSIONNUMBER.bin
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: .pio/build/esp12e/dtuGateway_release_${{ env.CURRENT_VERSIONNUMBER }}.bin

Expand Down
15 changes: 11 additions & 4 deletions include/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@

struct UserConfig
{
char dtuSsid[32];
char dtuPassword[32];
char wifiSsid[32];
char wifiPassword[32];
char dtuSsid[64];
char dtuPassword[64];
char wifiSsid[64];
char wifiPassword[64];
char dtuHostIp[16];
char openhabHostIp[16];
char openItemPrefix[32];
boolean openhabActive;
char mqttBrokerIp[16];
int mqttBrokerPort;
char mqttBrokerUser[64];
char mqttBrokerPassword[64];
char mqttBrokerMainTopic[32];
boolean mqttActive;
int dtuCloudPauseTime;
boolean dtuCloudPauseActive;
int dtuUpdateTime;
Expand Down
46 changes: 46 additions & 0 deletions include/display.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef DISPLAY_H
#define DISPLAY_H

#include <U8g2lib.h>

// OLED display

#define BRIGHTNESS_MIN 50
#define BRIGHTNESS_MAX 250

struct DisplayData {
int16_t totalPower=0; // indicate current power (W)
float totalYieldDay=0.0f; // indicate day yield (Wh)
float totalYieldTotal=0.0f; // indicate total yield (kWh)
const char *formattedTime=nullptr;
const char *version=nullptr;
uint8_t powerLimit=0;
uint8_t rssiGW=0;
uint8_t rssiDTU=0;
};

class Display {
public:
Display();
void setup();
void renderScreen(String time, String version);
private:
void drawScreen();
void drawHeader();
void drawFooter();

void drawMainDTUOnline(bool pause=false);
void drawMainDTUOffline();

void screenSaver();
void checkChangedValues();
// private member variables
DisplayData lastDisplayData;
uint8_t brightness=BRIGHTNESS_MIN;
u8g2_uint_t offset_x = 0; // shifting for anti burn in effect
u8g2_uint_t offset_y = 0; // shifting for anti burn in effect
bool valueChanged = false;
uint16_t displayTicks = 0; // local timer state machine
};

#endif // DISPLAY_H
Loading

0 comments on commit 26f68d8

Please sign in to comment.