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
/* ------------------------------------------------------------------------- * | |
* (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
// 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
// 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
// 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
dialogue = [ | |
{type:"caption", value:"Boat registration"}, | |
{type:"text", value:"You may register your boat here", style:{size:16}}, | |
{type:"field", label:"Boat name", width:250, fieldStyle:{italic:true}}, | |
{type:"radio", label:"Type", value:["Yacht","Motor cruiser","Keel boat","Dinghy"]}, | |
{type:"field", label:"Model", }, | |
{type:"slider", label:"Length (m)", range:[2, 40], value:10}, | |
{type:"spinner", label:"Draught (decimeters)", range:[10,30], value:20}, | |
{type:"tickList", label:"Down wind sails", value:["Spinnaker","Cruising 'chute", "Code 0"]}, | |
{type:"hLine"}, |
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
// time-out exerciser and tester | |
function calc(n){ // this takes some time | |
a = 99999; | |
while(n-- > 0) a = Math.sqrt(a); | |
} | |
var calcLength = 1000 | |
try {scriptResult("");} // supress result | |
catch(err){throw("Timeouts not supported in plugin versions efore 0.3");} |
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
dialogue = [ | |
{type:"text", value:"Register your boat"}, | |
{type:"field", label:"Name"}, | |
{type:"field", label:"Length", suffix:"m", width:30}, | |
{type:"radio", label:"type", value:["yacht", "motor cruiser", "keelboat", "dinghy"]}, | |
{type:"tick", value:"share details?"}, | |
{type:"button", label:["cancel", "register"]} | |
]; | |
OCPNonDialogue(handle, dialogue); |
NewerOlder