Skip to content

Commit

Permalink
merging
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteSchm committed Apr 7, 2023
2 parents 9521dee + fd94a69 commit cb6b984
Show file tree
Hide file tree
Showing 72 changed files with 1,576 additions and 1,091 deletions.
40 changes: 26 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,31 +107,43 @@ jobs:
.pio/build/${{ matrix.environment }}/bootloader.bin
.pio/build/${{ matrix.environment }}/boot_app0.bin
- uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: opendtu-release
path: |
.pio/build/${{ matrix.environment }}/opendtu-${{ matrix.environment }}.bin
.pio/build/${{ matrix.environment }}/partitions.bin
.pio/build/${{ matrix.environment }}/bootloader_dio_40m.bin
.pio/build/${{ matrix.environment }}/boot_app0.bin
release:
name: Create Release
runs-on: ubuntu-latest
needs: [get_default_envs, build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3.7.0
with:
failOnError: true
commitMode: true
configuration: ".github/workflows/config/release-notes-config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v3
with:
name: opendtu-release
path: artifacts/

- name: Create ZIPs
run: |
ls -R
sudo apt install zip
cd artifacts
for i in */; do zip -r "${i%/}.zip" "$i"; done
for i in */; do cp ${i}opendtu-*.bin ./; done
- name: Create draft release
- name: Create release
uses: softprops/action-gh-release@v1
with:
draft: True
body: ${{steps.github_release.outputs.changelog}}
draft: False
files: |
*.bin
artifacts/*.zip, artifacts/*.bin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 44 additions & 0 deletions .github/workflows/config/release-notes-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"categories": [
{
"title": "## ⚡ Breaking Changes",
"labels": [
"breaking change"
]
},
{
"title": "## 🚀 Features",
"labels": [
"feature"
]
},
{
"title": "## 🐛 Fixes",
"labels": [
"fix"
]
},
{
"title": "## 📚 Documentation",
"labels": [
"doc"
]
},
{
"title": "## 🛠 Under the hood",
"labels": []
}
],
"template": "${{CHANGELOG}}",
"pr_template": "- [${{TITLE}}](https://github.com/tbnobody/OpenDTU/commit/${{MERGE_SHA}})",
"empty_template": "- no changes",
"label_extractor": [
{
"pattern": "(.): (.+)",
"target": "$1"
}
],
"tag_resolver": {
"method": "sort"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
pip install cpplint
- name: Linting
run: |
cpplint --repository=. --recursive --filter=-runtime/references,-readability/braces,-whitespace,-legal,-build/include ./src ./include ./lib/Hoymiles
cpplint --repository=. --recursive --filter=-runtime/references,-readability/braces,-whitespace,-legal,-build/include ./src ./include ./lib/Hoymiles ./lib/MqttSubscribeParser ./lib/TimeoutHelper ./lib/ResetReason
22 changes: 22 additions & 0 deletions .github/workflows/yarnlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Yarn Linting

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Node.js and yarn
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: "webapp/yarn.lock"

- name: Install WebApp dependencies
run: yarn --cwd webapp install --frozen-lockfile

- name: Linting
run: yarn --cwd webapp lint
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This is a fork from the Hoymiles project OpenDTU.

![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/helgeerbe/OpenDTU?label=based%20on%20original%20OpenDTU)

## Extensions to the original OpenDTU

This project is still under development and adds following features:
Expand All @@ -17,6 +19,7 @@ This project is still under development and adds following features:

[![OpenDTU Build](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml/badge.svg)](https://github.com/tbnobody/OpenDTU/actions/workflows/build.yml)
[![cpplint](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml/badge.svg)](https://github.com/tbnobody/OpenDTU/actions/workflows/cpplint.yml)
[![Yarn Linting](https://github.com/tbnobody/OpenDTU/actions/workflows/yarnlint.yml/badge.svg)](https://github.com/tbnobody/OpenDTU/actions/workflows/yarnlint.yml)

## !! IMPORTANT UPGRADE NOTES !!

Expand Down Expand Up @@ -195,6 +198,7 @@ Topics for 3 phases of a power meter is configurable. Given is an example for th
* Hoymiles HM-1000
* Hoymiles HM-1200
* Hoymiles HM-1500
* Solenso SOL-H350
* Solenso SOL-H400
* Solenso SOL-H800
* TSUN TSOL-M350 (Maybe depending on firmware/serial number on the inverter)
Expand Down
4 changes: 3 additions & 1 deletion docs/DeviceProfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,6 @@ The json file can contain multiple profiles. Each profile requires a name and di
| display.data | number | Data Pin (e.g. SDA for i2c displays) required for all displays. Use 255 for not assigned pins. |
| display.clk | number | Clock Pin (e.g. SCL for i2c displays) required for SSD1306 and SH1106. Use 255 for not assigned pins. |
| display.cs | number | Chip Select Pin required for PCD8544. Use 255 for not assigned pins. |
| display.reset | number | Reset Pin required for PCD8544, optional for all other displays. Use 255 for not assigned pins. |
| display.reset | number | Reset Pin required for PCD8544, optional for all other displays. Use 255 for not assigned pins. |
| led.led0 | number | LED pin for network indication. Blinking = WLAN connected but NTP & MQTT (if enabled) disconnected. On = WLAN, NTP, MQTT connected. Off = Network not connected |
| led.led1 | number | LED pin for inverter indication. On = All inverters reachable & producing. Blinking = All inverters reachable but not producing. Off = At least one inverter is not reachable. Only inverters with polling enabled are considered. |
64 changes: 64 additions & 0 deletions docs/DeviceProfiles/blinkyparts_esp32.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[
{
"name": "LEDs, Display",
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"display": {
"type": 3,
"data": 21,
"clk": 22
},
"led": {
"led0": 25,
"led1": 26
}
},
{
"name": "Only Display",
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"display": {
"type": 3,
"data": 21,
"clk": 22
}
},
{
"name": "Only LEDs",
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
},
"led": {
"led0": 25,
"led1": 26
}
},
{
"name": "No Output",
"nrf24": {
"miso": 19,
"mosi": 23,
"clk": 18,
"irq": 16,
"en": 4,
"cs": 5
}
}
]
35 changes: 35 additions & 0 deletions include/Led_Single.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include "PinMapping.h"
#include <TimeoutHelper.h>

#define LEDSINGLE_UPDATE_INTERVAL 2000

enum eLedFunction {
CONNECTED_NETWORK,
CONNECTED_MQTT,
INV_REACHABLE,
INV_PRODUCING,
};

class LedSingleClass {
public:
LedSingleClass();
void init();
void loop();

private:
enum class LedState_t {
On,
Off,
Blink,
};

LedState_t _ledState[PINMAPPING_LED_COUNT];
TimeoutHelper _updateTimeout;
TimeoutHelper _blinkTimeout;
uint8_t _ledActive = 0;
};

extern LedSingleClass LedSingle;
2 changes: 2 additions & 0 deletions include/PinMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdint.h>

#define PINMAPPING_FILENAME "/pin_mapping.json"
#define PINMAPPING_LED_COUNT 2

#define MAPPING_NAME_STRLEN 31

Expand Down Expand Up @@ -39,6 +40,7 @@ struct PinMapping_t {
uint8_t huawei_irq;
uint8_t huawei_cs;
uint8_t huawei_power;
int8_t led[PINMAPPING_LED_COUNT];
};

class PinMappingClass {
Expand Down
9 changes: 5 additions & 4 deletions include/PowerLimiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef enum {

typedef enum {
EMPTY_WHEN_FULL= 0,
EMPTY_AT_NIGTH
EMPTY_AT_NIGHT
} batDrainStrategy;


Expand All @@ -28,9 +28,10 @@ class PowerLimiterClass {
int32_t getLastRequestedPowewrLimit();

private:
uint32_t _lastCommandSent;
uint32_t _lastLoop;
int32_t _lastRequestedPowerLimit;
uint32_t _lastCommandSent = 0;
uint32_t _lastLoop = 0;
int32_t _lastRequestedPowerLimit = 0;
uint32_t _lastLimitSetTime = 0;
plStates _plState = STATE_DISCOVER;

float _powerMeter1Power;
Expand Down
8 changes: 4 additions & 4 deletions lib/Hoymiles/src/Hoymiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void HoymilesClass::loop()
if (_radio->isIdle()) {
std::shared_ptr<InverterAbstract> iv = getInverterByPos(inverterPos);
if (iv != nullptr) {
_messageOutput->print(F("Fetch inverter: "));
_messageOutput->print("Fetch inverter: ");
_messageOutput->println(iv->serial(), HEX);

iv->sendStatsRequest(_radio.get());
Expand All @@ -54,19 +54,19 @@ void HoymilesClass::loop()

// Set limit if required
if (iv->SystemConfigPara()->getLastLimitCommandSuccess() == CMD_NOK) {
_messageOutput->println(F("Resend ActivePowerControl"));
_messageOutput->println("Resend ActivePowerControl");
iv->resendActivePowerControlRequest(_radio.get());
}

// Set power status if required
if (iv->PowerCommand()->getLastPowerCommandSuccess() == CMD_NOK) {
_messageOutput->println(F("Resend PowerCommand"));
_messageOutput->println("Resend PowerCommand");
iv->resendPowerControlRequest(_radio.get());
}

// Fetch dev info (but first fetch stats)
if (iv->Statistics()->getLastUpdate() > 0 && (iv->DevInfo()->getLastUpdateAll() == 0 || iv->DevInfo()->getLastUpdateSimple() == 0)) {
_messageOutput->println(F("Request device info"));
_messageOutput->println("Request device info");
iv->sendDevInfoRequest(_radio.get());
}
}
Expand Down
Loading

0 comments on commit cb6b984

Please sign in to comment.