295abb37ee
Firmware for an autonomous wave-measurement buoy (ATmega2560-based WII5 v2 board). Reads wave motion from a Sparton AHRS-M1/M2 IMU, samples GPS and battery state, and reports back over Iridium SBD satellite telemetry. Originally developed 2012-2024. This is the first public release. Code, documentation, and field-tested operating modes (Capture, Sleep, Position, ManualTest, SelfTest, LowBattery) are licensed under Apache 2.0 — see LICENSE and NOTICE. See README.md for an overview and build instructions, CONTRIBUTING.md for how to contribute, and DEPLOYMENTS.md for the field-deployment log.
238 lines
9.7 KiB
C++
238 lines
9.7 KiB
C++
// SPDX-License-Identifier: Apache-2.0
|
|
// Copyright (c) 2012-2024 Scott Penrose <scottp@dd.com.au> and WII5 Buoy contributors
|
|
//
|
|
// This file is part of WII5 Buoy firmware.
|
|
// See LICENSE for full terms.
|
|
|
|
/**
|
|
* @file WII5Help.cpp
|
|
* @brief Help-text generator for the `@Help` console command.
|
|
*/
|
|
|
|
/*
|
|
|
|
WII5Help
|
|
|
|
Top Commands
|
|
|
|
* Inputs:
|
|
@Help
|
|
@WII5
|
|
|
|
* Outputs:
|
|
@List
|
|
@File
|
|
|
|
*/
|
|
|
|
#include <Arduino.h>
|
|
#include <WII5Help.h>
|
|
|
|
bool WII5Help::processConsoleCsv() {
|
|
// Top page
|
|
if (console.getCsvCount() < 2)
|
|
return displayIndex();
|
|
|
|
if (console.getCsvCount() < 3) {
|
|
if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("info")) == 0)
|
|
return displayInfo();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("general")) == 0)
|
|
return displayGeneral();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("advanced")) == 0)
|
|
return displayAdvanced();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("setting")) == 0)
|
|
return displaySettings();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("maths")) == 0)
|
|
return displayMaths();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("storage")) == 0)
|
|
return displayStorage();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("gps")) == 0)
|
|
return displayGps();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("iridium")) == 0)
|
|
return displayIridium();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("sparton")) == 0)
|
|
return displaySparton();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("hardware")) == 0)
|
|
return displayHardware();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("data")) == 0)
|
|
return displayData();
|
|
else if (strcmp_P(console.getCsvBuffer(1),(PGM_P) F("testing")) == 0)
|
|
return displayTesting();
|
|
}
|
|
|
|
// 404 - Not found
|
|
return display404();
|
|
}
|
|
|
|
// TODO Look at help modules Arduino
|
|
bool WII5Help::displayIndex() {
|
|
console.printf(F("WII5: Help - page = Index\r\n"));
|
|
console.printf(F("Commands list:\r\n"));
|
|
return displayList();
|
|
}
|
|
|
|
// Not found !
|
|
bool WII5Help::display404() {
|
|
console.printf(F("NOT FOUND!"));
|
|
return false;
|
|
}
|
|
|
|
// List help pages
|
|
bool WII5Help::displayList() {
|
|
console.printf(F("# @Help COMMANDS:\r\n"));
|
|
console.printf(F("# - @Help - Here\r\n"));
|
|
console.printf(F("# - @Help,info - how to get information\r\n"));
|
|
console.printf(F("# - @Help,general - display general commands\r\n"));
|
|
console.printf(F("# - @Help,testing - how to run manual and self testing modes\r\n"));
|
|
console.printf(F("# - @Help,hardware - brief information on hardware\r\n"));
|
|
console.printf(F("# - @Help,data - brief information on data formats\r\n"));
|
|
console.printf(F("# - @Help,setting\r\n"));
|
|
console.printf(F("# - @Help,storage\r\n"));
|
|
console.printf(F("# - @Help,gps\r\n"));
|
|
console.printf(F("# - @Help,iridium - iridium and communications menu\r\n"));
|
|
console.printf(F("# - @Help,sparton\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displayInfo() {
|
|
console.printf(F("# @Help info:\r\n"));
|
|
console.printf(F("# * @WII5,hello - TODO 2024\r\n"));
|
|
console.printf(F("# * @WII5,people - List people\r\n"));
|
|
console.printf(F("# * @WII5,status - TODO 2024\r\n"));
|
|
console.printf(F("# * @WII5,dump - TODO 2024\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displayGeneral() {
|
|
console.printf(F("# @Help general:\r\n"));
|
|
console.printf(F("# * @WII5,General\r\n"));
|
|
console.printf(F("# * @WII5,reset,666 - Reset now - must have 666\r\n"));
|
|
console.printf(F("# * @WII5,status - List status of all objects\r\n"));
|
|
console.printf(F("# * @WII5,log,default - Log level set to default\r\n"));
|
|
console.printf(F("# * @WII5,log,debug - Log level set to debug\r\n"));
|
|
console.printf(F("# * @WII5,log,error - Log level set to error\r\n"));
|
|
console.printf(F("# * @WII5,log,fatal - Log level set to fatal\r\n"));
|
|
console.printf(F("# * @WII5,log,test - Test the log levels\r\n"));
|
|
// TODO 2024 change this to date in #define? TODO 2024 better copyright
|
|
console.printf(F("# * Copyright PAS Consultants Pty. Ltd. 2024\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displayAdvanced() {
|
|
console.printf(F("# @Help advanced:\r\n"));
|
|
console.printf(F("# * @WII5,help\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displaySettings() {
|
|
console.printf(F("# @Help setting:\r\n"));
|
|
console.printf(F("# * @WII5,setting,list\r\n"));
|
|
console.printf(F("# * @WII5,setting,deviceid,{n} (10000 to 99999)\r\n"));
|
|
console.printf(F("# This is written to EEPROM and used for all directories\r\n"));
|
|
console.printf(F("# * @WII5,setting,time,yyyy,mm,dd,hh,mm,ss\r\n"));
|
|
console.printf(F("# eg: @WII5,setting,time,2017,01,07,11,01,02\r\n"));
|
|
console.printf(F("# to set the time from an authoratataive source (e.g. NTPD)"));
|
|
console.printf(F("# * @WII5,setting,mode,default|yyyy-mm-ddThh:mm|time_t,v1,v2,v3,v4\r\n"));
|
|
console.printf(F("# If you add a date, time it will be saved to temporary mode\r\n"));
|
|
console.printf(F("# * @WII5,(TODO)mode,default|time_t future,mode,x,y,z\r\n"));
|
|
console.printf(F("# * @WII5,setting,defaults\r\n")); // NOTE, add 3759 to reset counters too
|
|
console.printf(F("# * @WII5,setting,gpstimeout,{seconds}\r\n"));
|
|
console.printf(F("# * @WII5,setting,captureoptions,{minutes},{binaryType}\r\n"));
|
|
console.printf(F("# Type and Records can be 0 or left off, minutes is required.\r\n"));
|
|
console.printf(F("# eg: @WII5,setting,captureoptions,15,03,5120\r\n"));
|
|
console.printf(F("# Minutes in caption must be between 15 (1/4 hr) and 720 (12 hr)\r\n"));
|
|
console.printf(F("# * @WII5,setting,positionoptions,{minutes},{binaryType}\r\n"));
|
|
console.printf(F("# eg: @WII5,setting,positionoptions,5,01\r\n"));
|
|
console.printf(F("# * @WII5,setting,sleepoptions,{minutes},{binaryType}\r\n"));
|
|
console.printf(F("# eg: @WII5,setting,sleepoptions,720,01\r\n"));
|
|
console.printf(F("# Minutes in sleep must be between 60 (1hr) and 1440 (24 hr)\r\n"));
|
|
console.printf(F("# * @WII5,help\r\n"));
|
|
return true;
|
|
}
|
|
|
|
bool WII5Help::displayMaths() {
|
|
console.printf(F("# @Help maths:\r\n"));
|
|
console.printf(F("# Controlling the maths CPU\r\n"));
|
|
console.printf(F("# * @WII5,maths,status - current status\r\n"));
|
|
console.printf(F("# * @WII5,maths,start - startup the CPU\r\n"));
|
|
console.printf(F("# * @WII5,maths,stop - stop the CPU\r\n"));
|
|
console.printf(F("# * @WII5,maths,restart - Restart cpu (forced)\r\n"));
|
|
console.printf(F("# * @WII5,maths,flip - Stop CPU, flip SD cards and restart CPU\n"));
|
|
console.printf(F("# * @WII5,maths,beep - Beep this AVR - sent from the Maths CPU\r\n"));
|
|
console.printf(F("# * @WII5,maths,hold,{n} - Hold maths on for {n} minutes\r\n"));
|
|
return true;
|
|
}
|
|
|
|
bool WII5Help::displayStorage() {
|
|
console.printf(F("# @Help storage:\r\n"));
|
|
console.printf(F("# Storage class is used to manuall control and retrieve data\r\n"));
|
|
console.printf(F("# from the storage devices.\r\n"));
|
|
console.printf(F("# * @WII5,storage,status\r\n"));
|
|
console.printf(F("# * @WII5,storage,off\r\n"));
|
|
console.printf(F("# * @WII5,storage,sd1\r\n"));
|
|
console.printf(F("# * @WII5,storage,sd2\r\n"));
|
|
console.printf(F("# * @WII5,storage,list\r\n"));
|
|
console.printf(F("# * @WII5,storage,view,{block_id}\r\n"));
|
|
console.printf(F("# * @WII5,storage,results,{id}\r\n"));
|
|
console.printf(F("# * @WII5,storage,debug,{0|1}\r\n"));
|
|
console.printf(F("# * @WII5,storage,format,1\r\n"));
|
|
console.printf(F("# * @WII5,storage,format,2\r\n"));
|
|
|
|
/*
|
|
console.printf(F("# * @WII5,storage,this1maths2\r\n"));
|
|
console.printf(F("# * @WII5,storage,this2maths1\r\n"));
|
|
console.printf(F("# * @WII5,storage,dir,{new} - Get direcotry or set directory\r\n"));
|
|
console.printf(F("# * @WII5,storage,ls - List files\r\n"));
|
|
console.printf(F("# * @WII5,storage,records - List record IDs\r\n"));
|
|
console.printf(F("# * @WII5,storage,record,{id} - Get {current}, {next} or {n}\r\n"));
|
|
console.printf(F("# * @WII5,storage,read,{filename} - start reading {filename}\r\n"));
|
|
console.printf(F("# * @WII5,storage,read! - stop reading\r\n"));
|
|
*/
|
|
return true;
|
|
}
|
|
bool WII5Help::displayGps() {
|
|
console.printf(F("# @Help gps:\r\n"));
|
|
console.printf(F("# * @WII5,gps,status\r\n"));
|
|
console.printf(F("# * @WII5,gps,dump\r\n"));
|
|
console.printf(F("# * @WII5,gps,start\r\n"));
|
|
console.printf(F("# * @WII5,gps,stop\r\n"));
|
|
console.printf(F("# * @WII5,gps,passthrug,0|1\r\n"));
|
|
console.printf(F("# * @WII5,gps,debug,0|1\r\n"));
|
|
console.printf(F("# * @WII5,gps,autopos\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displayIridium() {
|
|
console.printf(F("# @Help iridium:\r\n"));
|
|
console.printf(F("# * @WII5,communications,disabled,{0|1} - Set communications to be disabled or enabled\r\n"));
|
|
console.printf(F("# * @WII5,iridium,status - TODO 2024 most of these are not written, fix\r\n"));
|
|
console.printf(F("# * @WII5,iridium,off - force fully off, including power\r\n"));
|
|
console.printf(F("# * @WII5,iridium,last - Show again last data, inclding in progress\r\n"));
|
|
console.printf(F("# * @WII5,iridium,metadata - Firmware, Time, Signal Quality\r\n"));
|
|
console.printf(F("# * @WII5,iridium,sendtext,{rest is text}\r\n"));
|
|
console.printf(F("# * @WII5,iridium,sendbinary,{length} - must already be set in binary console\r\n"));
|
|
return true;
|
|
}
|
|
bool WII5Help::displaySparton() {
|
|
console.printf(F("# @Help sparton:\r\n"));
|
|
console.printf(F("# * @WII5,sparton,off - power off sparton\r\n"));
|
|
return true;
|
|
}
|
|
|
|
bool WII5Help::displayHardware() {
|
|
console.printf(F("# @Help hardware:\r\n"));
|
|
// TODO 2024 add
|
|
return true;
|
|
}
|
|
|
|
bool WII5Help::displayData() {
|
|
console.printf(F("# @Help data:\r\n"));
|
|
console.printf(F("# @WII5,bindata,<id>\r\n"));
|
|
return true;
|
|
}
|
|
|
|
bool WII5Help::displayTesting() {
|
|
console.printf(F("# @Help testing:\r\n"));
|
|
// TODO 2024 add
|
|
console.printf(F("# * @WII5,weather,read - read the temperature sensor and display\r\n"));
|
|
console.printf(F("# * @WII5,TODO 2024\r\n"));
|
|
return true;
|
|
}
|
|
|
|
WII5Help wii5Help;
|