Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoconf prevent 'init.bat' from stopping on empty lines #22158

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
- SML trx pin error (#22119)
- Shutter remaining issues on shutterinvert (#22120)
- Berry I2C to prepare M5Stack I2C STM32 based devices (#22143)
- Autoconf prevent 'init.bat' from stopping on empty lines

### Removed

Expand Down
12 changes: 9 additions & 3 deletions lib/libesp32/berry_tasmota/src/embedded/autoconf_module.be
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,16 @@ autoconf_module.init = def (m)
try
f = open(fname, "r") # open file in read-only mode, it is expected to exist
while true
var line = f.readline() # read each line, can contain a terminal '\n', empty if end of file
if size(line) == 0 break end # end of file
var line = f.readline() # read each line, can contain a terminal '\n'

if (size(line) == 0) && (f.tell() >= f.size()) # did we reach end of file?
break
end

while (size(line) > 0 && (line[-1] == "\n" || line[-1] == "\r"))
line = line[0..-2] # remove any trailing '\n' or '\r'
end

while (size(line) > 0 && (line[-1] == "\n" || line[-1] == "\r")) line = line[0..-2] end # remove any trailing '\n' or '\r'
if size(line) > 0
tasmota.cmd(line) # run the command
end
Expand Down
Loading