Bernhard Kirchen
b1edb13b3c
add and use configuration write guard
...
the configuration write guard is now required when the configuration
struct shall be mutated. the write guards locks multiple writers against
each other and also, more importantly, makes the writes synchronous to
the main loop. all code running in the main loop can now be sure that
(1) reads from the configuration struct are non-preemtive and (2) the
configuration struct as a whole is in a consistent state when reading
from it.
NOTE that acquiring a write guard from within the main loop's task will
immediately cause a deadlock and the watchdog will trigger a reset. if
writing from inside the main loop should ever become necessary, the
write guard must be updated to only lock the mutex but not wait for a
signal.
2024-10-22 20:39:23 +02:00
Thomas Basler
2f41f43d49
Update bblanchon/ArduinoJson from 7.1.0 to 7.2.0
2024-09-21 00:12:15 +02:00
Thomas Basler
980e847ccb
Feature: Check for out of memory situations when sending json responses
...
Also shows a nice message in the frontend if an internal error occours
2024-04-05 19:14:56 +02:00
Thomas Basler
2e3125fe8d
Feature: Migrated ArduinoJson 6 to 7
2024-04-05 19:14:56 +02:00
Thomas Basler
8add226a7c
Save flash: Move WebApi json parsing to separate method to prevent a lot of redundant code
2024-04-01 13:52:09 +02:00
Thomas Basler
2716f4c5df
Removed not required pointer to AsyncServer instance
2024-01-27 01:09:55 +01:00
Thomas Basler
251d197fb6
Migrate WebApi loop() methods to scheduler tasks
2024-01-20 02:00:22 +01:00
Thomas Basler
3c37b61f44
Use auto keyword and references more often
2024-01-04 15:38:56 +01:00
Thomas Basler
4053e31a5e
Prevent config corruption by checking whether memory allocation was successfull.
2024-01-04 13:42:39 +01:00
Thomas Basler
e95afbf2cc
Use references instead of pointers whenver possible
2023-12-12 13:26:07 +01:00
Thomas Basler
47e905bcfc
Add const statement to several variables
2023-12-11 19:54:57 +01:00
Thomas Basler
b85c53f476
Split config struct into different sub structs
2023-11-19 14:53:26 +01:00
Stefan Oberhumer
943dfc2dbf
Compute sunrise and sunset only if necessary.
...
Sunrise and -set must recomputed if one of the following conditions is met:
* The date changed (based on the selected timezone)
* Location (Lat/Lon) changed
* Sunset type changed
So instead of calculating that every minute just do it on update via web interface or date change.
If a new config is uploaded, the DTU gets restarted. There is no need to initiate a recalculation in this case.
2023-10-06 10:20:36 +02:00
Thomas Basler
a68c553d27
Code formatting without functional changes
2023-07-22 18:07:03 +02:00
Thomas Basler
7f267ff2fb
Fix: Lint Error: Almost always, snprintf is better than strcpy
2023-06-01 23:30:13 +02:00
Thomas Basler
5a37948ca9
Fix: If no sunset/sunrise calculation is possible a wrong value is shown
...
This is catched now and a proper message is shown in the web UI. Also the mode is set to day.
2023-06-01 18:39:50 +02:00
Thomas Basler
e7198073af
Feature: Allow configuration of sunset type
2023-05-24 19:21:44 +02:00
Thomas Basler
d6028cbd50
Remove not required F() macro. Frees ~20kb flash.
2023-04-04 18:51:18 +02:00
Thomas Basler
b319c78dc1
Added methods to calculate and show sunrise and sunset times
2023-02-18 18:15:48 +01:00
Thomas Basler
19a1c0aa54
Added config parameters to set longitude and latitude
2023-02-18 16:53:28 +01:00
Thomas Basler
6ad7e971b4
Introduce numeric error codes in ntp webapi
2022-12-24 00:01:55 +01:00
Thomas Basler
54d94af487
Cleanup includes
2022-12-14 22:13:03 +01:00
Thomas Basler
e8c517f650
Fix timezone specific issue when syncing time manually
...
Time was off by one hour when using the sync button in the web UI.
tm_isdst = -1 means that mktime determines the DST flag based on the current timezone
2022-11-29 22:55:14 +01:00
Thomas Basler
510f0c59f9
Implement readonly security for API endpoints
2022-11-22 23:40:19 +01:00
Thomas Basler
dd7babb448
Added a timeout of 5ms to detect current time.
...
This prevents false positives when a interrupt occours during the reading of the time
2022-11-14 20:19:38 +01:00
Thomas Basler
3a2f73a2b3
Password protection for ntp settings API
2022-11-03 21:20:12 +01:00
Thomas Basler
678f165350
Fix warning: missing initializer for member
2022-10-19 22:16:29 +02:00
Thomas Basler
cc7df7c302
Removed senseless checks
...
uint can never by smaller than 0
2022-10-18 21:43:12 +02:00
Thomas Basler
89e5f7e393
Added API to set and get the current time
2022-09-20 19:44:24 +02:00
Thomas Basler
950b211fd5
Set getLocalTime timeout to 0 to prevent watchdog triggers
...
This happens especially when no WiFi is configured and the user enters the NTP info page
2022-09-19 20:45:44 +02:00
Thomas Basler
de33b9ff88
Do not use namespace using-directives. Use using-declarations instead.
2022-09-13 21:35:51 +02:00
Thomas Basler
66c28a2e6e
Replace strcpy by strlcpy
2022-09-13 21:20:08 +02:00
Thomas Basler
31e56f6c2b
Code hardening: introduce const keyword
2022-09-05 21:41:45 +02:00
Thomas Basler
37aac48a19
Change License to GPLv2 as the RF24 lib uses GPL-2.0-only
2022-07-15 18:05:58 +02:00
Thomas Basler
92abfdfaa6
Separated WebApi into different files
2022-06-15 23:46:22 +02:00