From 272bb84a16c98853ff13ea29c5f344b1062e92e3 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 11:22:11 +0100 Subject: [PATCH 1/6] move back as link was broken in readme.md --- .github/CONTRIBUTING.md => CONTRIBUTING.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/CONTRIBUTING.md => CONTRIBUTING.md (100%) diff --git a/.github/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 100% rename from .github/CONTRIBUTING.md rename to CONTRIBUTING.md From b11f9be5e78dcfea41afdf23b0a4003e5b2efd49 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 11:22:21 +0100 Subject: [PATCH 2/6] script to update web as I'm lazy --- scripts/update_web.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/update_web.sh diff --git a/scripts/update_web.sh b/scripts/update_web.sh new file mode 100644 index 000000000..f83fb757d --- /dev/null +++ b/scripts/update_web.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# run from root +# make sure ncu is installed globally (https://github.com/raineorshine/npm-check-updates) + +cd interface +ncu -u +yarn set version stable +yarn +yarn format +yarn lint + +cd ../mock-api +ncu -u +yarn set version stable +yarn +yarn format + +cd .. \ No newline at end of file From 4de56af85a6cfef91978ef8bb1870f41f85a0ea8 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 11:22:30 +0100 Subject: [PATCH 3/6] text changes for upload files --- interface/src/i18n/en/index.ts | 2 +- interface/src/i18n/fr/index.ts | 2 +- interface/src/i18n/it/index.ts | 2 +- interface/src/i18n/nl/index.ts | 2 +- interface/src/i18n/no/index.ts | 2 +- interface/src/i18n/pl/index.ts | 2 +- interface/src/i18n/sv/index.ts | 2 +- interface/src/i18n/tr/index.ts | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index 9400b363a..6322e5ecf 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -186,7 +186,7 @@ const en: Translation = { BUFFER_SIZE: 'Max Buffer Size', COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', UPLOAD_DROP_TEXT: 'Drop file or click here', ERROR: 'Unexpected Error, please try again', TIME_SET: 'Time set', diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index c78dd7284..b67c49b0b 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -186,7 +186,7 @@ const fr: Translation = { BUFFER_SIZE: 'Max taille du buffer', COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Déposer le fichier ou cliquer ici', ERROR: 'Erreur inattendue, veuillez réessayer', TIME_SET: 'Time set', diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 777d54071..c77196fe3 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -186,7 +186,7 @@ const it: Translation = { BUFFER_SIZE: 'Max Buffer Size', COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Trascina il file o clicca qui', ERROR: 'Errore Inaspettato, prego tenta ancora', TIME_SET: 'Imposta Ora', diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index f1a19eccb..188dde66c 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -186,7 +186,7 @@ const nl: Translation = { BUFFER_SIZE: 'Max Buffer Size', COMPACT: 'Compact', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Sleep bestand hierheen of klik hier', ERROR: 'Onverwachte fout, probeer opnieuw', TIME_SET: 'Tijd ingesteld', diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index 491fd8644..5b6e61283 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -186,7 +186,7 @@ const no: Translation = { BUFFER_SIZE: 'Max Buffer Størrelse', COMPACT: 'Komprimere', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Slipp fil eller klikk her', ERROR: 'Ukjent feil, prøv igjen', TIME_SET: 'Still in tid', diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index e00939545..f566d5648 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -186,7 +186,7 @@ const pl: BaseTranslation = { BUFFER_SIZE: 'Maksymalna pojemność bufora (ilość wpisów)', COMPACT: 'Kompaktowy', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Przeciągnij tutaj plik lub kliknij', ERROR: 'Nieoczekiwany błąd, spróbuj ponownie!', TIME_SET: 'Zegar został ustawiony.', diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 43c2682d1..a14dd4440 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -186,7 +186,7 @@ const sv: Translation = { BUFFER_SIZE: 'Max Bufferstorlek', COMPACT: 'Komprimera', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Släpp fil eller klicka här', ERROR: 'Okänt Fel, var god försök igen', TIME_SET: 'Ställ in tid', diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index d47c2220b..9cf0f14d2 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -186,7 +186,7 @@ const tr: Translation = { BUFFER_SIZE: 'En fazla bellek boyutu', COMPACT: 'Sıkışık', DOWNLOAD_SETTINGS_TEXT: 'Create a backup of your configuration and settings', // TODO translate - UPLOAD_TEXT: 'Upload a new firmware (.bin) file or a backup file (.json)', // TODO translate + UPLOAD_TEXT: 'Upload a new firmware file (.bin) or a backup file (.json)', // TODO translate UPLOAD_DROP_TEXT: 'Buraya tıklayın yada dosyayı sürükleyip bırakın', ERROR: 'Beklenemedik hata, lütfen tekrar deneyin.', TIME_SET: 'Zaman ayarı', From 4471c1fad67c8cb987562acc5207f3cbae032f6d Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 12:19:09 +0100 Subject: [PATCH 4/6] minor tidy up --- Makefile | 38 +++++++++++++++++++----- cspell.json | 22 +++++++++++++- echo_progress.py | 27 +++++++++++++++++ scripts/generate_csv_and_headers.sh | 4 +-- scripts/{update_web.sh => update_all.sh} | 6 +++- 5 files changed, 86 insertions(+), 11 deletions(-) create mode 100644 echo_progress.py rename scripts/{update_web.sh => update_all.sh} (70%) diff --git a/Makefile b/Makefile index 8f6fc27a0..50e25201f 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,25 @@ # This is mainly used to generate the .o files for SonarQube analysis # -NUMJOBS=${NUMJOBS:-" -j10 "} -MAKEFLAGS+="j " +_mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) +I := $(patsubst %/,%,$(dir $(_mkfile_path))) + +ifneq ($(words $(MAKECMDGOALS)),1) +.DEFAULT_GOAL = all +%: + @$(MAKE) $@ --no-print-directory -rRf $(firstword $(MAKEFILE_LIST)) +else +ifndef ECHO +T := $(shell $(MAKE) $(MAKECMDGOALS) --no-print-directory \ + -nrRf $(firstword $(MAKEFILE_LIST)) \ + ECHO="COUNTTHIS" | grep -c "COUNTTHIS") +N := x +C = $(words $N)$(eval N := x $N) +ECHO = python $(I)/echo_progress.py --stepno=$C --nsteps=$T +endif + +JOBS ?= $(shell nproc) +MAKEFLAGS += -j $(JOBS) -l $(JOBS) #---------------------------------------------------------------------- # Project Structure @@ -125,23 +142,27 @@ COMPILE.cpp = $(CXX) $(CXX_STANDARD) $(CXXFLAGS) $(DEPFLAGS) -c $< -o $@ .SILENT: $(OUTPUT) all: $(OUTPUT) + @$(ECHO) All done $(OUTPUT): $(OBJS) @mkdir -p $(@D) + @$(ECHO) Linking $@ $(LINK.o) $(SYMBOLS.out) - + $(BUILD)/%.o: %.c @mkdir -p $(@D) - $(COMPILE.c) + @$(ECHO) Compiling $@ + @$(COMPILE.c) $(BUILD)/%.o: %.cpp @mkdir -p $(@D) - $(COMPILE.cpp) + @$(ECHO) Compiling $@ + @$(COMPILE.cpp) $(BUILD)/%.o: %.s @mkdir -p $(@D) - $(COMPILE.s) + @$(COMPILE.s) cppcheck: $(SOURCES) $(CPPCHECK) $(CHECKFLAGS) $^ @@ -150,6 +171,7 @@ run: $(OUTPUT) @$< .PHONY: clean + clean: @$(RM) -rf $(BUILD) $(OUTPUT) @@ -157,4 +179,6 @@ help: @echo available targets: all run clean @echo $(OUTPUT) --include $(DEPS) \ No newline at end of file +-include $(DEPS) + +endif diff --git a/cspell.json b/cspell.json index 3f245f844..febf7df15 100644 --- a/cspell.json +++ b/cspell.json @@ -9,5 +9,25 @@ } ], "dictionaries": ["project-words"], - "ignorePaths": ["node_modules", "compile_commands.json", "WWWData.h", "**/venv/**", "lib/eModbus", "lib/ESPAsyncWebServer", "lib/espMqttClient", "analyse.html", "dist", "**/*.csv", "**/*.md", "**/*.py", "locale_translations.h", "TZ.tsx", "**/*.txt","build/**", "**/i18n/**", "/project-words.txt"] + "ignorePaths": [ + "node_modules", + "compile_commands.json", + "WWWData.h", "**/venv/**", + "lib/eModbus", + "lib/ESPAsyncWebServer", + "lib/espMqttClient", + "analyse.html", + "dist", + "**/*.csv", + "**/*.md", + "**/*.py", + "locale_translations.h", + "TZ.tsx", + "**/*.txt", + "build/**", + "**/i18n/**", + "/project-words.txt", + "Makefile", + "src/modbus_entity_parameters.hpp" + ] } \ No newline at end of file diff --git a/echo_progress.py b/echo_progress.py new file mode 100644 index 000000000..e7136967c --- /dev/null +++ b/echo_progress.py @@ -0,0 +1,27 @@ +""" +Print makefile progress +""" + +import argparse +import math +import sys + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--stepno", type=int, required=True) + parser.add_argument("--nsteps", type=int, required=True) + parser.add_argument("remainder", nargs=argparse.REMAINDER) + args = parser.parse_args() + + nchars = int(math.log(args.nsteps, 10)) + 1 + fmt_str = "[{:Xd}/{:Xd}]({:6.2f}%)".replace("X", str(nchars)) + progress = 100 * args.stepno / args.nsteps + sys.stdout.write(fmt_str.format(args.stepno, args.nsteps, progress)) + for item in args.remainder: + sys.stdout.write(" ") + sys.stdout.write(item) + sys.stdout.write("\n") + +if __name__ == "__main__": + main() + \ No newline at end of file diff --git a/scripts/generate_csv_and_headers.sh b/scripts/generate_csv_and_headers.sh index d1b811ddb..756019d20 100755 --- a/scripts/generate_csv_and_headers.sh +++ b/scripts/generate_csv_and_headers.sh @@ -33,7 +33,7 @@ EOL # build emsesp for standalone make clean -make ARGS=-DEMSESP_STANDALONE +make -s ARGS=-DEMSESP_STANDALONE # Generate Modbus entity parameters # One to build the modbus_entity_parameters.hpp header file @@ -43,7 +43,7 @@ echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py | python3 ./ ls -al ./src/modbus_entity_parameters.hpp # dump_entities.csv -make ARGS=-DEMSESP_STANDALONE +make -s ARGS=-DEMSESP_STANDALONE rm -f ./docs/dump_entities.csv echo "test entity_dump" | ./emsesp | python3 ./scripts/strip_csv.py >./docs/dump_entities.csv ls -al ./docs/dump_entities.csv diff --git a/scripts/update_web.sh b/scripts/update_all.sh similarity index 70% rename from scripts/update_web.sh rename to scripts/update_all.sh index f83fb757d..a4117cdee 100644 --- a/scripts/update_web.sh +++ b/scripts/update_all.sh @@ -2,6 +2,7 @@ # run from root # make sure ncu is installed globally (https://github.com/raineorshine/npm-check-updates) +# as well as GNUMake (make) and python3 cd interface ncu -u @@ -16,4 +17,7 @@ yarn set version stable yarn yarn format -cd .. \ No newline at end of file +cd .. +npx cspell "**" + +sh ./scripts/generate_csv_and_headers.sh From 727d9bdf2e268ae4881bd3746b1087c6fbcae4d5 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 14:08:09 +0100 Subject: [PATCH 5/6] add comment --- echo_progress.py | 1 + 1 file changed, 1 insertion(+) diff --git a/echo_progress.py b/echo_progress.py index e7136967c..0a1a96529 100644 --- a/echo_progress.py +++ b/echo_progress.py @@ -1,5 +1,6 @@ """ Print makefile progress +From https://stackoverflow.com/questions/451413/make-makefile-progress-indication """ import argparse From a3964102c9d7cca737f284a816b09d3ed13391d4 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 28 Nov 2024 15:00:05 +0100 Subject: [PATCH 6/6] add comment --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 50e25201f..8674ab134 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ # # GNUMakefile for EMS-ESP -# This is mainly used to generate the .o files for SonarQube analysis # _mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) @@ -20,6 +19,7 @@ C = $(words $N)$(eval N := x $N) ECHO = python $(I)/echo_progress.py --stepno=$C --nsteps=$T endif +# number of parallel compiles JOBS ?= $(shell nproc) MAKEFLAGS += -j $(JOBS) -l $(JOBS)