Skip to content

Commit

Permalink
Update to gen_set.pl & cleanup in txt files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TobiasE-github committed Dec 1, 2024
1 parent 360f02d commit 75363fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
15 changes: 2 additions & 13 deletions lib/obp60task/Create_new_pages.txt
Original file line number Diff line number Diff line change
@@ -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

27 changes: 14 additions & 13 deletions lib/obp60task/gen_set.pl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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";
Expand All @@ -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++){
Expand All @@ -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";
}
}


10 changes: 9 additions & 1 deletion lib/obp60task/git_commands.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
git status
git fetch upstream
git diff --name-status upstream/master
git checkout upstream/master platformio.ini
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
2 changes: 2 additions & 0 deletions lib/obp60task/howto_compile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd /workspace/esp32-nmea2000-obp60
bash /workspace/esp32-nmea2000-obp60/lib/obp60task/run

0 comments on commit 75363fa

Please sign in to comment.