From 1bc896dfd791a337f6020013195cc9ed11a115cf Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 09:20:50 +0000 Subject: [PATCH 1/8] modified: lib/obp60task/PageRollPitch.cpp --> fixed Typo --- lib/obp60task/PageRollPitch.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 9bc9b49..33f5142 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -353,7 +353,8 @@ PageDescription registerPageRollPitch( "RollPitch", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - {"xdrRoll", "xdrPitch"},// Bus values we need in the page + {"xdrROLL", "xdrPTCH"},// Bus values we need in the page + // {"xdrRoll", "xdrPitch"},// Bus values we need in the page true // Show display header on/off ); From 94510878cd1092a1daffdb2a139f992cb4229220 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 09:22:00 +0000 Subject: [PATCH 2/8] modified: lib/obp60task/PageRollPitch.cpp Typo --- lib/obp60task/PageRollPitch.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 33f5142..cf4cbdd 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -70,7 +70,9 @@ public: else{ svalue1 = String(value1/(2*PI)*360,0); } - + if(valid1 == true){ + svalue1old = svalue1; // Save the old value + } // Get boat values for pitch GwApi::BoatValue *bvalue2 = pageData.values[1]; // Second element in list (xdrPitch) String name2 = xdrDelete(bvalue2->getName()); // Value name @@ -93,6 +95,9 @@ public: else{ svalue2 = String(value2/(2*PI)*360,0); } + if(valid2 == true){ + svalue2old = svalue2; // Save the old value + } // Optical warning by limit violation if(String(flashLED) == "Limit Violation"){ From 38d8be874d5df88110003e62f5dceb697daa62a3 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 12:05:01 +0000 Subject: [PATCH 3/8] new file: lib/obp60task/gen_set.sh --- lib/obp60task/gen_set.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 lib/obp60task/gen_set.sh diff --git a/lib/obp60task/gen_set.sh b/lib/obp60task/gen_set.sh new file mode 100644 index 0000000..3b4ebeb --- /dev/null +++ b/lib/obp60task/gen_set.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "automated config generator" \ No newline at end of file From 960e80330f45d5970a6c7fdca94c1f6d7d81912f Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 17:58:03 +0000 Subject: [PATCH 4/8] new file: lib/obp60task/gen_set.pl --- lib/obp60task/gen_set.pl | 77 ++++++++++++++++++++++++++++++++++++++++ lib/obp60task/gen_set.sh | 2 -- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100755 lib/obp60task/gen_set.pl delete mode 100644 lib/obp60task/gen_set.sh diff --git a/lib/obp60task/gen_set.pl b/lib/obp60task/gen_set.pl new file mode 100755 index 0000000..e727da9 --- /dev/null +++ b/lib/obp60task/gen_set.pl @@ -0,0 +1,77 @@ +#!/bin/perl -w +use List::Util qw( min max ); +$NoOfPages=2; +@Defaults=qw(Voltage WindRose OneValue TwoValues ThreeValues FourValues FourValues2 Clock RollPitch Battery2); +@Numbers=qw(one two three four five six seven eight nine ten ); +%NoOfFields=qw( OneValue 1 + TwoValues 2 + ThreeValues 3 + FourValues 4 + FourValues2 4 + WindRoseFlex 6 + ApparentWind 0 + Autobahn 0 + Battery2 0 + Battery 0 + BME280 0 + Clock 0 + DST810 0 + Generator 0 + KeelPosition 0 + RollPitch 0 + RudderPosition 0 + Solar 0 + Voltage 0 + White 0 + WindRose 0 + ); +#@Pages=qw(ApparentWind Autobahn Battery2 Battery BME280 Clock DST810 FourValues2 FourValues Generator KeelPosition OneValue RollPitch RudderPosition Solar ThreeValues TwoValues Voltage White WindRose WindRoseFlex); +@Pages=keys(%NoOfFields); +$MaxNoOFFIelds=max(values(%NoOfFields)); + + +for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ + print "{\n"; + print "\t","\"name\": \"page", $PageNo,"type\",\n"; + print "\t","\"label\": \"Type\",\n"; + print "\t",'"type": "list",',"\n"; + print "\t",'"default": "'; + print "$Defaults[$PageNo-1]"; + print'"',"\n"; + print "\t",'"description": "Type of page for page ',$PageNo,'",',"\n"; + print "\t",'"list": ['; + for ($p=0;$p<=$#Pages;$p++) { + print '"', $Pages[$p], '"' ; + if ($p < $#Pages){print ","} + } + print "]\n"; + print "\t",'"category": "OBP60 Page 1",',"\n"; + print "\t",'"capabilities": {',"\n"; + print "\t\t",'"obp60":"true"',"\n"; + print "\t",'}',"\n"; + print '},',"\n"; + for ($FieldNo=1; $FieldNo<=$MaxNoOFFIelds;$FieldNo++){ + print "{\n"; + print "\t",'"name": "page',$PageNo,'value',$FieldNo,'",',"\n"; + print "\t",'"label": "Field ',$FieldNo,'",',"\n"; + print "\t",'"type": "boatData",',"\n"; + print "\t",'"default": "",',"\n"; + print "\t",'"description": "The display for field ',$Numbers[$FieldNo-1],'",',"\n"; + print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; + print "\t",'"capabilities": {',"\n"; + print "\t",' "obp60":"true"',"\n"; + print "\t",'},',"\n"; + print "\t",'"condition":['; + foreach $page (@Pages) { + if($NoOfFields{$page}>=$FieldNo){ + print '"page1type":"',$page,'"},'; + } + + #{"page1type":"OneValue"},{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"} + } + print "],\n"; + print '},',"\n"; + } +} + + diff --git a/lib/obp60task/gen_set.sh b/lib/obp60task/gen_set.sh deleted file mode 100644 index 3b4ebeb..0000000 --- a/lib/obp60task/gen_set.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "automated config generator" \ No newline at end of file From 85ad03e0fafc3a03c905f0761c077876d1b4c2e9 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 19:39:16 +0000 Subject: [PATCH 5/8] modified: lib/obp60task/gen_set.pl Bugfixes and some comments --- lib/obp60task/gen_set.pl | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/obp60task/gen_set.pl b/lib/obp60task/gen_set.pl index e727da9..35fb2db 100755 --- a/lib/obp60task/gen_set.pl +++ b/lib/obp60task/gen_set.pl @@ -1,14 +1,11 @@ #!/bin/perl -w +#A tool to generate that part of config.json that deals with pages and Fields. + use List::Util qw( min max ); -$NoOfPages=2; -@Defaults=qw(Voltage WindRose OneValue TwoValues ThreeValues FourValues FourValues2 Clock RollPitch Battery2); -@Numbers=qw(one two three four five six seven eight nine ten ); -%NoOfFields=qw( OneValue 1 - TwoValues 2 - ThreeValues 3 - FourValues 4 - FourValues2 4 - WindRoseFlex 6 + + +#List of all Pages and the number of parameters they expect. +%NoOfFieldsPerPage=qw( ApparentWind 0 Autobahn 0 Battery2 0 @@ -16,18 +13,27 @@ $NoOfPages=2; BME280 0 Clock 0 DST810 0 + FourValues2 4 + FourValues 4 Generator 0 KeelPosition 0 + OneValue 1 RollPitch 0 RudderPosition 0 Solar 0 + ThreeValues 3 + TwoValues 2 Voltage 0 White 0 WindRose 0 + WindRoseFlex 6 ); -#@Pages=qw(ApparentWind Autobahn Battery2 Battery BME280 Clock DST810 FourValues2 FourValues Generator KeelPosition OneValue RollPitch RudderPosition Solar ThreeValues TwoValues Voltage White WindRose WindRoseFlex); -@Pages=keys(%NoOfFields); -$MaxNoOFFIelds=max(values(%NoOfFields)); +# No changes neede beyond this pint +$NoOfPages=10; +@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)); for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ @@ -45,12 +51,18 @@ for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ if ($p < $#Pages){print ","} } print "]\n"; - print "\t",'"category": "OBP60 Page 1",',"\n"; + print "\t",'"category": "OBP60 Page ',$PageNo,'",',"\n"; print "\t",'"capabilities": {',"\n"; print "\t\t",'"obp60":"true"',"\n"; print "\t",'}',"\n"; + print "\t",'"condition":['; + 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<=$MaxNoOFFIelds;$FieldNo++){ + for ($FieldNo=1; $FieldNo<=$MaxNoOfFieldsPerPage;$FieldNo++){ print "{\n"; print "\t",'"name": "page',$PageNo,'value',$FieldNo,'",',"\n"; print "\t",'"label": "Field ',$FieldNo,'",',"\n"; @@ -63,13 +75,13 @@ for ($PageNo=1;$PageNo<=$NoOfPages;$PageNo++){ print "\t",'},',"\n"; print "\t",'"condition":['; foreach $page (@Pages) { - if($NoOfFields{$page}>=$FieldNo){ - print '"page1type":"',$page,'"},'; + if($NoOfFieldsPerPage{$page}>=$FieldNo){ + print '{"page1type":"',$page,'"},'; } #{"page1type":"OneValue"},{"page1type":"TwoValues"},{"page1type":"ThreeValues"},{"page1type":"FourValues"},{"page1type":"FourValues2"},{"page1type":"WindRoseFlex"} } - print "],\n"; + print "\b],\n"; print '},',"\n"; } } From 97c1c1fa2d25c2d784b9f38830b7c2b390dabaa7 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 19:44:56 +0000 Subject: [PATCH 6/8] modified: lib/obp60task/PageRollPitch.cpp back to standard --- lib/obp60task/PageRollPitch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 57e8dab..0cf5fb9 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -360,8 +360,8 @@ PageDescription registerPageRollPitch( "RollPitch", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - {"xdrROLL", "xdrPTCH"},// Bus values we need in the page - // {"xdrRoll", "xdrPitch"},// Bus values we need in the page + // {"xdrROLL", "xdrPTCH"},// Bus values we need in the page + {"xdrRoll", "xdrPitch"},// Bus values we need in the page true // Show display header on/off ); From f5aa0cd9682e444da3fc770036daea3a52aecc12 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 19:47:28 +0000 Subject: [PATCH 7/8] modified: lib/obp60task/PageRollPitch.cpp --- lib/obp60task/PageRollPitch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 0cf5fb9..48a1809 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -360,7 +360,7 @@ PageDescription registerPageRollPitch( "RollPitch", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - // {"xdrROLL", "xdrPTCH"},// Bus values we need in the page + // {"xdrROLL", "xdrPTCH"},// Bus values we need in the page {"xdrRoll", "xdrPitch"},// Bus values we need in the page true // Show display header on/off ); From a212f4165d1cb9ea854f690ab8841cc6473e93a0 Mon Sep 17 00:00:00 2001 From: Tobias E Date: Wed, 20 Nov 2024 19:59:01 +0000 Subject: [PATCH 8/8] modified: lib/obp60task/PageRollPitch.cpp fixed whitespace --- lib/obp60task/PageRollPitch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/obp60task/PageRollPitch.cpp b/lib/obp60task/PageRollPitch.cpp index 48a1809..0674e2b 100644 --- a/lib/obp60task/PageRollPitch.cpp +++ b/lib/obp60task/PageRollPitch.cpp @@ -360,7 +360,7 @@ PageDescription registerPageRollPitch( "RollPitch", // Page name createPage, // Action 0, // Number of bus values depends on selection in Web configuration - // {"xdrROLL", "xdrPTCH"},// Bus values we need in the page + // {"xdrROLL", "xdrPTCH"},// Bus values we need in the page {"xdrRoll", "xdrPitch"},// Bus values we need in the page true // Show display header on/off );