This commit is contained in:
Otto Winter 2019-05-24 17:20:06 +02:00
parent aa7389432e
commit 422754ed63
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
5 changed files with 21 additions and 8 deletions

View File

@ -19,7 +19,8 @@ void DeepSleepComponent::setup() {
void DeepSleepComponent::dump_config() {
ESP_LOGCONFIG(TAG, "Setting up Deep Sleep...");
if (this->sleep_duration_.has_value()) {
ESP_LOGCONFIG(TAG, " Sleep Duration: %u ms", *this->sleep_duration_ / 1000);
uint32_t duration = *this->sleep_duration_ / 1000;
ESP_LOGCONFIG(TAG, " Sleep Duration: %u ms", duration);
}
if (this->run_duration_.has_value()) {
ESP_LOGCONFIG(TAG, " Run Duration: %u ms", *this->run_duration_);

View File

@ -13,7 +13,7 @@ import threading
import click
sys.path.append(os.path.dirname(__file__))
from helpers import basepath, get_output, walk_files, filter_changed
from helpers import basepath, get_output, git_ls_files, filter_changed
is_py2 = sys.version[0] == '2'
@ -83,7 +83,7 @@ def main():
return 1
files = []
for path in walk_files(basepath):
for path in git_ls_files():
filetypes = ('.cpp', '.h', '.tcc')
ext = os.path.splitext(path)[1]
if ext in filetypes:

View File

@ -18,7 +18,7 @@ import threading
sys.path.append(os.path.dirname(__file__))
from helpers import basepath, shlex_quote, get_output, build_compile_commands, \
build_all_include, temp_header_file, walk_files, filter_changed
build_all_include, temp_header_file, git_ls_files, filter_changed
is_py2 = sys.version[0] == '2'
@ -100,7 +100,7 @@ def main():
build_compile_commands()
files = []
for path in walk_files(basepath):
for path in git_ls_files():
filetypes = ('.cpp',)
ext = os.path.splitext(path)[1]
if ext in filetypes:

View File

@ -126,3 +126,13 @@ def filter_changed(files):
for c in files:
print(" {}".format(c))
return files
def git_ls_files():
command = ['git', 'ls-files', '-s']
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
output, err = proc.communicate()
lines = [x.split() for x in output.decode('utf-8').splitlines()]
return {
s[3].strip(): int(s[0]) for s in lines
}

View File

@ -9,7 +9,7 @@ import re
import sys
sys.path.append(os.path.dirname(__file__))
from helpers import basepath, get_output, walk_files, filter_changed
from helpers import get_output, git_ls_files, filter_changed
def main():
@ -21,10 +21,10 @@ def main():
args = parser.parse_args()
files = []
for path in walk_files(basepath):
for path in git_ls_files():
filetypes = ('.py',)
ext = os.path.splitext(path)[1]
if ext in filetypes:
if ext in filetypes and path.startswith('esphome'):
path = os.path.relpath(path, os.getcwd())
files.append(path)
# Match against re
@ -35,6 +35,8 @@ def main():
files = filter_changed(files)
files.sort()
if not files:
sys.exit(0)
errors = collections.defaultdict(list)
cmd = ['flake8'] + files