Commit Graph

3559 Commits

Author SHA1 Message Date
Maxim Prokhorov
5f6df82110 gpio: source code locations of locks / unlocks
sorted in a reverse order of when they were called
refactor gpio module itself, so our `namespace { ... }` stays consistent

using GCC `__builtin_{LINE,FILE,FUNC}()`
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fLINE
https://en.cppreference.com/w/cpp/utility/source_location
2022-09-08 19:36:52 +03:00
Maxim Prokhorov
59686a80ac debug: revert forced gpio lock
ref. 8ceeebdb24
does not really do much, just causes yet another 'why does this driver
ignores pin 1 or 3' question by anyone trying to use buttons or relays

since we configure pins on per-driver basis and dont have global
'roles' assigned to each pin, it is pretty tricky to understand every
other dependency coming in at setup() time. right now, first one wins.

a bit more complex pre-setup() dependency resolution could also work,
and some concept that we depend on uart as peripheral and not just some pins
2022-09-08 18:37:54 +03:00
Maxim Prokhorov
7595d3357c terminal: revert UnescapedText handling
Totally breaks on unicode input.

Main reason to add this in the first place was handling of
terminal escape sequences, but perhaps it would be better off to do
that on another layer.

For example, <Backspace> will inject an invisible symbol into the resulting
'chunk', at least one other thing to do is to validate after we append
things into an 'argv' that it at least looks like some kind of text.
2022-09-08 15:56:52 +03:00
Maxim Prokhorov
798f1ed782 webui: rebuild blobs 2022-09-08 15:53:11 +03:00
Maxim Prokhorov
fc8bdef7d5 terminal: fixing web socket interface
Make the buffer work on '\n' instead of a limit, flush asap.
Still using single 'DEBUG' output for both terminal and debug prints;
we no longer have 'pre' and 'msg' distinction - there is just 'msg'.
2022-09-08 15:50:30 +03:00
Maxim Prokhorov
9b92144ab9 telnet: promptly flush() when buffers get filled up
implementation is a bit clunky, since WIFISERVER seems to be working
much slower with (or because?) of no-delay

pending some changes so we *always* schedule telnet comms in the loop
(which also would leave just one SERVER option, and also enable encryption)
2022-09-08 13:39:26 +03:00
Maxim Prokhorov
bb41673e48 terminal: deduce error from state when uninitialized
also refactor Values and Span as class methods
(since we are dealing with struct members anyway)
2022-09-08 13:39:26 +03:00
Maxim Prokhorov
0af60479e5 terminal: wait to concat for continuous data 2022-09-08 13:39:26 +03:00
Maxim Prokhorov
677f368cfa test: bump esp8266 version used for unit tests 2022-09-08 13:39:26 +03:00
Maxim Prokhorov
5f67212935 test: generate compile_commands.json 2022-09-08 13:39:26 +03:00
Maxim Prokhorov
2a5756e1b5 terminal: fix escaped characters parsing
also fix test entry incorrectly using an already escaped string
2022-09-08 13:39:26 +03:00
Maxim Prokhorov
ef202109e7 terminal: remove shared output
Make every available call site 'private'
e.g. typing command in telnet no longer prints to serial or WebUI

Serial input is now optional, see `TERMINAL_SERIAL_SUPPORT`.
Telnet using async server is a proper Print implementation now.
WebUI, MQTT and HTTP input is allowed to inject multiple lines at once.

Modernize our helper classes and remove legacy 2.3.0 quirks.
Replace global Terminal object and allow to separately
split, parse ARGV list and perform command search and invocation with
standalone function calls.
(but, notice that we still depend on a globally shared 'commands' list)

This greatly reduces used RAM (but, slightly increases our ROM).

Update our test suite to use namespaces and new calling convention.
2022-09-08 13:39:11 +03:00
Maxim Prokhorov
8bfc0c4882 hw: fix basic & basic-rf extra pin switch actions
https://gitter.im/tinkerman-cat/espurna?at=6302c2f2cf6cfd27af20f01b
should be toggle, same as the others

tnx to @luismaranesi
2022-09-01 04:55:54 +03:00
Maxim Prokhorov
d2e0bd9ac5 pio: update formatting 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
5527441d36 pio: cppcheck works with pio-check
https://docs.platformio.org/en/latest/core/userguide/cmd_check.html
2022-08-31 03:08:30 +03:00
Maxim Prokhorov
246364470c ci: compress debug symbols a bit more 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
038f1ffec3 pio: firmware.bin.gz builder 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
d17316f78c pio: fix .bin size check script dependency
cannot depend on checkprogsize, since it depends on .elf and not .bin

also, compare with the block-aligned size
add notes about reserved space

warning might become annoying, though :)
2022-08-31 03:08:06 +03:00
Maxim Prokhorov
e8e9c152e7 pio: missing scripts 2022-08-30 03:22:47 +03:00
Maxim Prokhorov
a6df38e807 pio: stack dump decoder script
from the pending ESP8266 Core PR
2022-08-30 03:18:11 +03:00
Maxim Prokhorov
74ce4d974d pio: update formatting 2022-08-30 03:18:11 +03:00
Maxim Prokhorov
c0e74e431d pio: prettier file size output 2022-08-30 03:18:07 +03:00
Maxim Prokhorov
fd249c8055 pio: also hide raw putc function in postmortem
updates scripts to be a post action
rename redefined symbols to stubs
2022-08-30 02:06:30 +03:00
Maxim Prokhorov
6f122f5ecb pio: debug info in distributed builds and build-and-copy fixes
store objcopy of these extra symbols and .map from the linker
distribution will have an extra debug .zip file that could be used with
the exception decoder

also fixes relative paths in the build-and-copy
(although, yet again loses the pio target in the gui)
2022-08-30 01:33:55 +03:00
Maxim Prokhorov
25f6b021f5 system: convert is not inline 2022-08-29 22:51:31 +03:00
Maxim Prokhorov
59c4246c68 system: hwdt reset should start the check
in case rare errors sneak up, do not force into unstable mode
previously removed rtcmem special case allows us to continue
2022-08-29 21:28:22 +03:00
Maxim Prokhorov
93da96ca25 settings: todo 2022-08-29 06:04:38 +03:00
Maxim Prokhorov
ff19c0889d test: fix namespaces 2022-08-29 06:01:21 +03:00
Maxim Prokhorov
98584aecc4 settings: clean up after namespace update
missing stringview key checks
fix template specialization order when building single source
update left-over modules that werent using espurna { ... }
2022-08-29 05:52:50 +03:00
Maxim Prokhorov
cc16c36736 light: experimental sequence support
execute multiple transition-initiating functions
when we don't do any transitions or have value changes queued

main application for right now is a simple notification
routine that consists of N single channel on->off transitions
2022-08-29 05:52:47 +03:00
Maxim Prokhorov
3e36438748 settings: key check with string view
make our string comparisons nicer
also clean-up namespaces for storage access
2022-08-29 04:37:58 +03:00
Maxim Prokhorov
deffe551ed emon: fix missing terminal output for energy 2022-08-29 03:13:29 +03:00
Maxim Prokhorov
3f7d832267 sns: dummy sensor energy counter 2022-08-29 03:10:40 +03:00
Maxim Prokhorov
f4951d7228 system: set unstable flag when hwdt reset happens
- reduce number of resets that triggers unstable mode
- introduce a reboot reason for stability counter
  which only gets handled on soft-reset
- allow to forcibly change to either stable or unstable mode
  more explicit terminal comands to leave or enter either mode
2022-08-29 03:09:12 +03:00
Maxim Prokhorov
7659a63441 board: hwdt still keeps valid rtcmem contents 2022-08-29 00:45:39 +03:00
Maxim Prokhorov
b9427de5c0 board: do not reset sdk when already reset 2022-08-29 00:43:09 +03:00
Maxim Prokhorov
e704efffb4 emon: fix infinite recursion 2022-08-28 23:35:40 +03:00
Maxim Prokhorov
16fcee1786 Fix namespacing scope, export StringView
rework more namespaces to use `espurna` root
makes internal references much easier (and shorter)

view class is not specific to settings, could use it across the app
remove duplicate code from IR
2022-08-25 00:41:26 +03:00
Maxim Prokhorov
037a76733c terminal: type ambiguity 2022-08-24 01:04:31 +03:00
Maxim Prokhorov
0e55397a4a sns: add missing sensor strings 2022-08-21 18:22:30 +03:00
Maxim Prokhorov
befa961a8e web: strict check for ap connection
also fix invalid header accessor, toString() returns the whole HTTP
request string as `Host: blabla\r\n`
2022-08-21 18:16:41 +03:00
Maxim Prokhorov
97a4e0a8fc pwm: default to 1kHz
new-lib does not appear to work very well with 2 kHz
2022-08-19 19:10:24 +03:00
Maxim Prokhorov
1bc0bcdbaa pwm: terminal command and new-lib clean-up
restore pinMode(..., OUTPUT)
manually set initial duty
2022-08-19 19:10:24 +03:00
Maxim Prokhorov
2365d08b88 pwm: also handle older Core versions
when target duty is either zero or at the driver limit, forcibly
stop the waveform / pwm driver via a sort-of private function call

resolve #2532
2022-08-19 19:07:30 +03:00
Maxim Prokhorov
16d61d5fc2 gpio: register access commands 2022-08-19 17:39:39 +03:00
Maxim Prokhorov
091c87ea45 gpio: fix not using provided mode in gpio16 case 2022-08-19 17:36:25 +03:00
Maxim Prokhorov
2868e0a481 pwm: arduino needs an explicit stop 2022-08-19 14:53:11 +03:00
Maxim Prokhorov
1cb841125f pwm: adjust for float precision loss 2022-08-19 13:27:52 +03:00
Maxim Prokhorov
08a31fcbf5 pwm: fix arduino pin init 2022-08-19 13:10:40 +03:00
Maxim Prokhorov
844f20003d pzem004tv30: convert to watt seconds just once 2022-08-18 22:09:59 +03:00