This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handles = OCPNgetActiveDriverHandles() | |
for (h = 0; h < handles.length; h++){ | |
attributes = OCPNgetDriverAttributes(handles[h]); | |
print(handles[h], "\t", attributes, "\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add hyperlinks to an existing waypoint with markName of 'lunch stop' | |
wpName = "lunch stop"; | |
guids = OCPNgetWaypointGUIDs(); | |
foundIt = false; | |
for (i = 0; i < guids.length; i++){ | |
// look for our waypoint | |
lunchWaypoint = OCPNgetSingleWaypoint(guids[i]); | |
if (lunchWaypoint.markName == wpName){ | |
foundIt = true; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script for the JavaScript plugin provides creation of racing routes by selecting race marks from a list | |
// being a subset of OpenCPN waypoints | |
Position = require("Position"); | |
// declare enduring variables | |
var routeName; | |
var replaceRoute; | |
var pattern; | |
var waypoints = []; // to be array of waypoints | |
var routeList = []; // array of pre-existing routes in OpenCPN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tack advisor v0.2.1 27 Sep 2021 | |
// Since v0.1 added down-wind tacking and onExit clean-up | |
// v0.2.1 removes degree character from comments in three places as Windows objects | |
// configuration | |
repeatInterval = 5; // seconds | |
// wind angles we will work at | |
minWindAngle = 10; // Min wind angle to work with | |
maxWindAngle = 60; // Max angle off wind we will work with | |
maxRunWindAngle = 179; // Don't work if virtually straight down wind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------------------------------------------------------------------- * | |
* (4) Add custom authentication function | |
/* ------------------------------------------------------------------------- */ | |
add_filter('authenticate', function($user, $email, $password){ | |
//Check for empty fields | |
if(empty($email) || empty ($password)){ | |
//create new error object and add errors to it. | |
$error = new WP_Error(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script sends any active route out as WPT and RTE sentences so that iNavX shows the up-to-date active route. | |
// If the route or its routepoints are updated, iNavX will update to reflect this | |
// V2.0 - major rewrite to utilise latest plugin capabilities - much simplified | |
Position = require("Position"); // load the required constructors | |
Route = require("Route"); | |
// here we define enduring variables we need outside the functions | |
var debug = false; // for debug prints | |
const prefix = "$JS"; // NMEA identifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drive ship in absence of real NMEA inputs | |
Position = require("Position"); | |
// we construct the panel dynamically, so we can note where things are | |
panel = []; | |
panel.push({type:"caption", value:"Simple ship and wind driver"}); | |
panel.push({type:"text", value:"Set desired parameters\nthen select action button to update"}); | |
panel.push({type:"text", value:"Status: Standing by"}); | |
statusRow = panel.length-1; | |
panel.push({type:"slider", range:[0,10], value:5, width:300, label:"SOG knots"}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// insert magnetic variation into RMC sentence | |
// corrected 22 Dec 2020 for NMEA sentence as structure | |
var vardegs = ""; | |
var varEW = ""; | |
OCPNonNMEAsentence(processNMEA); | |
function processNMEA(input){ | |
if (input.OK){ | |
sentence = input.value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// listens for OpenCPN sentences and NMEA messages over configured time and reports | |
// sorts NMEA messages by count and then alphabetically | |
var timeSeconds = 30; // time period over which to count | |
var progressSeconds = 5; // count down this often | |
var secondsLeft = timeSeconds; | |
var log = []; // will be array of entries | |
onSeconds(progress, 1); // count down every progressSeconds secs, but first almost immediately | |
onSeconds(report, timeSeconds); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Position, waypoint and route confidence tester | |
function compareWaypoints(waypoint1, waypoint2){ | |
// compares two waypoints and displays any mismatches. | |
// returns true if error else false if OK | |
function display(attribute){ | |
if (!displaying) printOrange("The following attributes of waypoints do not match:\n"); | |
displaying = true; | |
printOrange(attribute, "\n"); | |
} |
NewerOlder