From 75363fa4fd6b88298700f067fe92414963103695 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Sun, 1 Dec 2024 08:02:04 +0000 Subject: [PATCH] Update to gen_set.pl & cleanup in txt files Updated gen_set.pl since autobahn was renamed to XTETrack, and removed dependency on external perl modules Create_new_page.txt contained some notes on git commands and how to compile, moved to respective files. --- lib/obp60task/Create_new_pages.txt | 15 ++------------- lib/obp60task/gen_set.pl | 27 ++++++++++++++------------- lib/obp60task/git_commands.txt | 10 +++++++++- lib/obp60task/howto_compile.txt | 2 ++ 4 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 lib/obp60task/howto_compile.txt diff --git a/lib/obp60task/Create_new_pages.txt b/lib/obp60task/Create_new_pages.txt index 6bd0e86f..5ad71fd1 100644 --- a/lib/obp60task/Create_new_pages.txt +++ b/lib/obp60task/Create_new_pages.txt @@ -1,17 +1,6 @@ -git remote add upstream /url/to/original/repo -git fetch upstream -git checkout master -git reset --hard upstream/master -git push origin master --force - -https://github.com/norbert-walter/esp32-nmea2000-obp60 - - -cd /workspace/esp32-nmea2000-obp60 -bash /workspace/esp32-nmea2000-obp60/lib/obp60task/run - Craete new page for OBP60 1. Create page under /lib/obp60task/PageXXXX.cpp 2. Set page name in PageXXXX.cpp on file name 3. Register new page in /lib/obp60task/obp60task.cpp line 242 (registerAllPages) -4. Add new page in /lib/obp60task/config.json for each page type +4. Add new page in /lib/obp60task/config.json for each page type or add new page to gen_set.pl and run it to auto-generate the relevant section of config.json + diff --git a/lib/obp60task/gen_set.pl b/lib/obp60task/gen_set.pl index 35fb2dbb..a83bda2f 100755 --- a/lib/obp60task/gen_set.pl +++ b/lib/obp60task/gen_set.pl @@ -1,13 +1,10 @@ #!/bin/perl -w -#A tool to generate that part of config.json that deals with pages and Fields. +#A tool to generate that part of config.json that deals with pages and fields. -use List::Util qw( min max ); - - -#List of all Pages and the number of parameters they expect. +#List of all pages and the number of parameters they expect. %NoOfFieldsPerPage=qw( ApparentWind 0 - Autobahn 0 + XTETrack 0 Battery2 0 Battery 0 BME280 0 @@ -28,14 +25,23 @@ WindRose 0 WindRoseFlex 6 ); -# No changes neede beyond this pint +# No changes needed beyond this point +#max number of pages supported by OBP60 $NoOfPages=10; +#Default selection for each page @Defaults=qw(Voltage WindRose OneValue TwoValues ThreeValues FourValues FourValues2 Clock RollPitch Battery2); @Numbers=qw(one two three four five six seven eight nine ten); @Pages=sort(keys(%NoOfFieldsPerPage)); -$MaxNoOfFieldsPerPage=max(values(%NoOfFieldsPerPage)); +$MaxNoOfFieldsPerPage=0; # inital value, gets updated with maximum entry from %NoOfFieldsPerPage +#find max. number of fields without additional modules + foreach (values(%NoOfFieldsPerPage)){ + if ($_ > $MaxNoOfFieldsPerPage){ + $MaxNoOfFieldsPerPage=$_; + } + } + for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ print "{\n"; print "\t","\"name\": \"page", $PageNo,"type\",\n"; @@ -59,7 +65,6 @@ for ($vp=$PageNo;$vp<=$NoOfPages;$vp++){ print '"{visiblePages":"',$vp,'"},'; } - #"visiblePages":"2"},{"visiblePages":"3"},{"visiblePages":"4"},{"visiblePages":"5"},{"visiblePages":"6"},{"visiblePages":"7"},{"visiblePages":"8"},{"visiblePages":"9"},{"visiblePages":"10"} print "\b",']',"\n"; print '},',"\n"; for ($FieldNo=1; $FieldNo<=$MaxNoOfFieldsPerPage;$FieldNo++){ @@ -78,12 +83,8 @@ if($NoOfFieldsPerPage{$page}>=$FieldNo){ print '{"page1type":"',$page,'"},'; } - - #{"page1type":"OneValue"},{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"} } print "\b],\n"; print '},',"\n"; } } - - diff --git a/lib/obp60task/git_commands.txt b/lib/obp60task/git_commands.txt index ffda6eaa..39d3fda1 100644 --- a/lib/obp60task/git_commands.txt +++ b/lib/obp60task/git_commands.txt @@ -1,4 +1,12 @@ git status git fetch upstream git diff --name-status upstream/master -git checkout upstream/master platformio.ini \ No newline at end of file +git checkout upstream/master platformio.ini + +# how to reset my Repo to match norbert'status + +git remote add upstream https://github.com/norbert-walter/esp32-nmea2000-obp60 +git fetch upstream +git checkout master +git reset --hard upstream/master +git push origin master --force \ No newline at end of file diff --git a/lib/obp60task/howto_compile.txt b/lib/obp60task/howto_compile.txt new file mode 100644 index 00000000..a5d28ce6 --- /dev/null +++ b/lib/obp60task/howto_compile.txt @@ -0,0 +1,2 @@ +cd /workspace/esp32-nmea2000-obp60 +bash /workspace/esp32-nmea2000-obp60/lib/obp60task/run \ No newline at end of file