Skip to content

Commit 2ff9549

Browse files
committed
fix logging and device counter was not stored #29 #33
1 parent 2d3bcca commit 2ff9549

File tree

14 files changed

+63
-75
lines changed

14 files changed

+63
-75
lines changed

changeNew.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ this is a minor bugfix version
99

1010
- [IMPROVE] improved Login Form Feedback for Incorrect Credentials
1111
- [IMPROVE] add build script to automatically update version in github-pages
12+
- [BUGFIX] fix missing log entries from jarolift-controller library #29 #33
13+
- [BUGFIX] device counter was not saved after editing in WebUI settings #33

include/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*-------------------------------------------------------------------------------
55
General Configuration
66
--------------------------------------------------------------------------------*/
7-
#define VERSION "v1.6.2" // internal program version
7+
#define VERSION "v1.6.3" // internal program version
88

99
#define WIFI_RECONNECT 30000 // Delay between wifi reconnection tries
1010
#define MQTT_RECONNECT 10000 // Delay between mqtt reconnection tries

include/gzip_css.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

include/gzip_js.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

include/gzip_login_html.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
const uint8_t PROGMEM gzip_login_html[] = {0x1f, 0x8b, 0x08, 0x00, 0x97, 0xf9, 0xae, 0x67, 0x02, 0xff, 0x75, 0x53, 0xb1, 0x92, 0xd4, 0x30, 0x0c, 0xed, 0xef, 0x2b, 0x84, 0x5b, 0xc8, 0xe6, 0x38, 0x1a, 0x8a, 0x64, 0x1b, 0xb8, 0x2b, 0x18, 0x66, 0xd8, 0x19, 0x8e, 0x82, 0x52, 0x89, 0xb5, 0xb1, 0xe7, 0x1c, 0xdb, 0xd8, 0xca, 0xee, 0x85, 0xaf, 0xc7, 0x59, 0x27, 0x24, 0x3b, 0x2c, 0x95, 0xe5, 0xf7, 0xe4, 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58, 0x5e, 0x68, 0xde, 0x63, 0xda, 0xc5, 0xe5, 0xbb, 0xfd, 0x01, 0x84, 0x40, 0xe8, 0x4e, 0x7f, 0x03, 0x00, 0x00};
2-
const unsigned int gzip_login_html_size = 448;
1+
const uint8_t PROGMEM gzip_login_html[] = {0x1f, 0x8b, 0x08, 0x00, 0xac, 0xde, 0xb1, 0x67, 0x02, 0xff, 0x8d, 0x55, 0xcd, 0x8e, 0xdb, 0x36, 0x10, 0xbe, 0xfb, 0x29, 0x26, 0x3c, 0xc9, 0x88, 0x2d, 0x35, 0xc9, 0xa5, 0xf0, 0x4a, 0x06, 0xd2, 0xae, 0x03, 0xb4, 0x08, 0x90, 0x05, 0x76, 0x5b, 0xa0, 0x47, 0x5a, 0x1c, 0x5b, 0x6c, 0x28, 0x52, 0x21, 0x29, 0x3b, 0xce, 0xc2, 0xef, 0x9e, 0xa1, 0x64, 0x59, 0x92, 0x57, 0x5b, 0x54, 0x17, 0x71, 0x66, 0xbe, 0xf9, 0x1f, 0x0e, 0xd3, 0x37, 0xf7, 0x5f, 0x7e, 0x7f, 0xfa, 0xe7, 0x61, 0x03, 0x85, 0x2f, 0xd5, 0x7a, 0x96, 0x86, 0x1f, 0x28, 0xae, 0xf7, 0x19, 0x43, 0xcd, 0x40, 0x48, 0x9b, 0x31, 0xe5, 0x2d, 0x9d, 0xb8, 0xe7, 0x4b, 0x5f, 0x60, 0x89, 0x19, 0x13, 0xdc, 0x7e, 0x65, 0xeb, 0x19, 0x40, 0x5a, 0x20, 0x17, 0xe1, 0x40, 0xc7, 0x12, 0x3d, 0x87, 0xbc, 0xe0, 0xd6, 0xa1, 0xcf, 0xd8, 0x5f, 0x4f, 0x9f, 0x96, 0xbf, 0x32, 0x48, 0x86, 0x42, 0xcd, 0x83, 0x32, 0xaf, 0x2a, 0x85, 0xcb, 0xd2, 0x6c, 0x25, 0xfd, 0x8e, 0xb8, 0x5d, 0x12, 0x63, 0x99, 0xf3, 0x8a, 0x6f, 0x15, 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0x54, 0x68, 0xa7, 0x90, 0xc0, 0xe3, 0x94, 0x06, 0xd3, 0xe3, 0x6a, 0x8a, 0xc8, 0xb9, 0xf9, 0x0b, 0x04, 0xc0, 0x51, 0x6a, 0x61, 0x8e, 0xb1, 0x32, 0x6d, 0x98, 0x71, 0xd8, 0xc1, 0x34, 0xbb, 0x2c, 0x61, 0x77, 0x37, 0xd8, 0xc9, 0xd1, 0x09, 0xdf, 0xf8, 0x4e, 0x3c, 0xd3, 0x7e, 0xa0, 0xd4, 0xaf, 0x7b, 0x68, 0x01, 0xcd, 0x04, 0xad, 0x9a, 0xf7, 0x2e, 0xee, 0xd8, 0x8d, 0x02, 0x15, 0xe0, 0xee, 0xff, 0x59, 0xbb, 0xee, 0x84, 0xb1, 0xb5, 0x8e, 0xfd, 0x9a, 0xb5, 0xf3, 0x88, 0xbe, 0x2d, 0x37, 0x65, 0x4c, 0x13, 0x11, 0xa1, 0xb5, 0xc6, 0x36, 0xf5, 0xa3, 0x27, 0xc5, 0x19, 0x85, 0x71, 0xc3, 0x89, 0xd8, 0x26, 0xfc, 0x56, 0xe4, 0xb2, 0x45, 0x0c, 0xac, 0x77, 0x9e, 0xd2, 0xa4, 0x5f, 0x13, 0xb4, 0x6f, 0x9a, 0x17, 0x85, 0x5e, 0x85, 0xe6, 0xe1, 0xff, 0x09, 0x37, 0x87, 0x5f, 0x56, 0x09, 0x08, 0x00, 0x00};
2+
const unsigned int gzip_login_html_size = 839;

include/gzip_m_html.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

include/gzip_ntp_html.h

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

include/message.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
#define MAX_LOG_LINES 200 // max log lines
77
#define MAX_LOG_ENTRY 128 // max length of one entry
88

9-
// #ifndef MY_LOGGER_SUPPORT
10-
// #define MY_LOGGER_SUPPORT
11-
// #define ESP_LOGE(tag, format, ...) esp_log_write(ESP_LOG_ERROR, tag, "E (APP-%s): " format "\n", tag, ##__VA_ARGS__)
12-
// #define ESP_LOGI(tag, format, ...) esp_log_write(ESP_LOG_INFO, tag, "I (APP-%s): " format "\n", tag, ##__VA_ARGS__)
13-
// #define ESP_LOGW(tag, format, ...) esp_log_write(ESP_LOG_WARN, tag, "W (APP-%s): " format "\n", tag, ##__VA_ARGS__)
14-
// #define ESP_LOGD(tag, format, ...) esp_log_write(ESP_LOG_DEBUG, tag, "D (APP-%s): " format "\n", tag, ##__VA_ARGS__)
15-
// #endif
16-
179
struct s_logdata {
1810
int lastLine;
1911
char buffer[MAX_LOG_LINES][MAX_LOG_ENTRY];

lib/JaroliftController/JaroliftController.cpp

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "esp_log.h"
21
#include <JaroliftController.h>
32
#include <nvs.h>
43
#include <nvs_flash.h>
@@ -10,7 +9,7 @@
109

1110
#define BITS_SIZE 8
1211

13-
static const char *TAG = "JARO-CTRL"; // LOG TAG
12+
static const char *TAG = "JARO-LIB"; // LOG TAG
1413

1514
// RX variables and defines
1615
#define debounce 200 // Ignoring short pulses in reception... no clue if required and if it makes sense ;)
@@ -116,7 +115,23 @@ void JaroliftController::devcnt_handler(bool do_increment) {
116115
// ####################################################################
117116
void JaroliftController::setDeviceCounter(uint16_t newDevCnt) {
118117
devcnt = newDevCnt;
119-
devcnt_handler(false);
118+
119+
nvs_handle_t nvs_handle;
120+
esp_err_t err = nvs_open(NVS_NAMESPACE, NVS_READWRITE, &nvs_handle);
121+
if (err != ESP_OK) {
122+
ESP_LOGE(TAG, "Failed to open NVS");
123+
return;
124+
}
125+
126+
nvs_set_u16(nvs_handle, "devcnt", devcnt);
127+
nvs_commit(nvs_handle);
128+
129+
ESP_LOGD(TAG, "stored Device Counter: %i", devcnt);
130+
ESP_LOGW(TAG, "Wstored Device Counter: %i", devcnt);
131+
ESP_LOGE(TAG, "Estored Device Counter: %i", devcnt);
132+
133+
nvs_close(nvs_handle);
134+
120135
delay(100);
121136
}
122137

@@ -145,6 +160,7 @@ uint16_t JaroliftController::getDeviceCounter() {
145160
}
146161

147162
nvs_close(nvs_handle);
163+
148164
return devcnt;
149165
}
150166

@@ -361,7 +377,7 @@ uint8_t JaroliftController::getRssi() {
361377
value = rssi / 2;
362378
value = value + 74;
363379
}
364-
ESP_LOGD(TAG, " CC1101_RSSI: %i", value);
380+
ESP_LOGD(TAG, "CC1101_RSSI: %i", value);
365381
return value;
366382
} // void ReadRSSI
367383

@@ -684,6 +700,8 @@ void JaroliftController::cmdUpDown(uint8_t channel) {
684700

685701
void JaroliftController::begin() {
686702

703+
ESP_LOGI(TAG, "start CC1101 setup");
704+
687705
EEPROM.begin(sizeof(devcnt));
688706
devcnt = getDeviceCounter();
689707

@@ -773,11 +791,9 @@ void JaroliftController::loop() {
773791
steadycnt = 0;
774792
}
775793

776-
ESP_LOGD(TAG, "(INF1) serial: 0x%08lx, rx_function: 0x%x, rx_disc_low: %d, rx_disc_high: %d", rx_serial, rx_function, rx_disc_low[0],
777-
rx_disc_h);
794+
ESP_LOGD(TAG, "(INF1) serial: 0x%08lx, rx_function: 0x%x, rx_disc_low: %d, rx_disc_high: %d", rx_serial, rx_function, rx_disc_low[0], rx_disc_h);
778795
ESP_LOGD(TAG, "(INF2) RSSI: %d, counter: %d", getRssi(), rx_disc_low[3]);
779-
ESP_LOGD(TAG, "(INF3) rx_device_key_lsb: 0x%08x, rx_device_key_msb: 0x%08x, decoded: 0x%08lx", rx_device_key_lsb, rx_device_key_msb,
780-
decoded);
796+
ESP_LOGD(TAG, "(INF3) rx_device_key_lsb: 0x%08x, rx_device_key_msb: 0x%08x, decoded: 0x%08lx", rx_device_key_lsb, rx_device_key_msb, decoded);
781797

782798
rx_disc_h = 0;
783799
rx_hopcode = 0;

lib/JaroliftController/JaroliftController.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,15 @@ class JaroliftController {
1818
void ReadRSSI();
1919
void enterrx();
2020
void entertx();
21-
void (*messageCallback)(esp_log_level_t level, const char *msg) = nullptr;
22-
23-
static constexpr size_t MAX_MESSAGE_LENGTH = 256;
24-
25-
void sendMsg(esp_log_level_t level, const char *format, ...) {
26-
if (messageCallback != nullptr) {
27-
// Puffer für die formatierte Nachricht
28-
char buffer[MAX_MESSAGE_LENGTH];
29-
30-
// Variadische Argumente verarbeiten
31-
va_list args;
32-
va_start(args, format);
33-
vsnprintf(buffer, MAX_MESSAGE_LENGTH, format, args);
34-
va_end(args);
35-
36-
// Callback mit der formatierten Nachricht aufrufen
37-
messageCallback(level, buffer);
38-
} else {
39-
// Fallback, wenn kein Callback gesetzt ist
40-
printf("[Fallback Handler]: Callback not set.\n");
41-
}
42-
}
4321

22+
4423
public:
4524
void begin();
4625

4726
void loop();
4827

4928
void setGPIO(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t gdo0, int8_t gdo2);
5029

51-
void setMessageCallback(void (*callback)(esp_log_level_t level, const char *msg)) { messageCallback = callback; }
52-
5330
bool getCC1101State(void);
5431

5532
uint8_t getRssi();

0 commit comments

Comments
 (0)