Working version.

This commit is contained in:
Holger Weber
2026-05-15 00:44:46 +02:00
parent 088eb07ff3
commit d2ab1369f6
6 changed files with 16 additions and 8 deletions

View File

@@ -18,10 +18,12 @@ Die Datei `include/config.h` enthält:
- `WIFI_PASSWORD`
- `TASMOTA_HOST`
- `INITIAL_TIMER_MS`
- `MIN_TIMER_MS`
- `MAX_TIMER_MS`
Als Vorlage liegt `include/config.example.h` bei.
## Hardware
Board D1 Mini mit ESP8266.
OLED über I2C an den GPIOs 4 und 5. Rotary Encoder mit A und B an GPIO 14 und 16 und der Taster an 12.
OLED über I2C an den GPIOs 4 und 5. Rotary Encoder mit A und B an GPIO 14 und 13 und der Taster an 12.
OLED hat einen SSD1309 Controller mit 128x64 Pixel.

View File

@@ -2,10 +2,12 @@
#include <stdint.h>
#include "config.h"
namespace trbc {
constexpr uint16_t kMinTimerMs = 2000;
constexpr uint16_t kMaxTimerMs = 10000;
constexpr uint16_t kMinTimerMs = MIN_TIMER_MS;
constexpr uint16_t kMaxTimerMs = MAX_TIMER_MS;
constexpr uint16_t kTimerStepMs = 100;
uint16_t clampTimerMs(int valueMs);

View File

@@ -6,3 +6,5 @@
#define WIFI_PASSWORD "your-password"
#define TASMOTA_HOST "192.168.1.50"
#define INITIAL_TIMER_MS 5000
#define MIN_TIMER_MS 2000
#define MAX_TIMER_MS 10000

View File

@@ -7,3 +7,5 @@
#define WIFI_PASSWORD "!Sternenlabor99!"
#define TASMOTA_HOST "192.168.240.101"
#define INITIAL_TIMER_MS 5000
#define MIN_TIMER_MS 2000
#define MAX_TIMER_MS 13000

View File

@@ -10,7 +10,7 @@ namespace {
constexpr uint8_t kOledAddress = 0x3C;
constexpr uint8_t kPinEncoderA = 14;
constexpr uint8_t kPinEncoderB = 16;
constexpr uint8_t kPinEncoderB = 13;
constexpr uint8_t kPinButton = 12;
constexpr uint8_t kPinSda = 4;
constexpr uint8_t kPinScl = 5;

View File

@@ -3,9 +3,9 @@
#include "PulseTimer.h"
void test_clamps_timer_range() {
TEST_ASSERT_EQUAL_UINT16(2000, trbc::clampTimerMs(1000));
TEST_ASSERT_EQUAL_UINT16(MIN_TIMER_MS, trbc::clampTimerMs(MIN_TIMER_MS - 1000));
TEST_ASSERT_EQUAL_UINT16(5000, trbc::clampTimerMs(5000));
TEST_ASSERT_EQUAL_UINT16(10000, trbc::clampTimerMs(12000));
TEST_ASSERT_EQUAL_UINT16(MAX_TIMER_MS, trbc::clampTimerMs(MAX_TIMER_MS + 2000));
}
void test_adjusts_in_100_ms_steps() {
@@ -14,8 +14,8 @@ void test_adjusts_in_100_ms_steps() {
}
void test_adjustment_stays_in_range() {
TEST_ASSERT_EQUAL_UINT16(2000, trbc::adjustTimerMs(2000, -1));
TEST_ASSERT_EQUAL_UINT16(10000, trbc::adjustTimerMs(10000, 1));
TEST_ASSERT_EQUAL_UINT16(MIN_TIMER_MS, trbc::adjustTimerMs(MIN_TIMER_MS, -1));
TEST_ASSERT_EQUAL_UINT16(MAX_TIMER_MS, trbc::adjustTimerMs(MAX_TIMER_MS, 1));
}
void test_converts_to_tasmota_pulsetime_units() {