Skip to content

Commit

Permalink
Autoconf prevent 'init.bat' from stopping on empty lines (#22158)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Sep 17, 2024
1 parent a5730a7 commit 717bc01
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 202 deletions.
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

0 comments on commit 717bc01

Please sign in to comment.