Skip to content

Commit

Permalink
debug set by menu instead of hard-coded, default is off
Browse files Browse the repository at this point in the history
  • Loading branch information
hfmark committed Aug 27, 2024
1 parent 41db2d4 commit daacfa2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 2 deletions.
Binary file modified docs/main.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions docs/main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ \subsection{Database files}

gravitron's files can also be edited/updated with new information. If there are stations, meters, or ships that should be added, please contact PFPE.

\subsection{Debug mode}
\label{nobugs}
The `File' menu has an option to toggle debug mode on and off. By default, debug mode is off when gravitron starts. The status column will say `debug off' when debug mode is off, and you will want to keep it off while you are taking a tie. In fact, you'll probably just want to keep it off all the time -- users can safely ignore this setting.

If you turn debug mode on and try to calculate bias with some timestamped water height measurements and some loaded gravimeter data file, gravitron will internally select timestamps for the water height measurments from the times in the data file and use those times for the calculation. This is useful if you want to try out gravitron using a random old data file and don't feel like manually setting timestamps in a toml file to match the data timespan, because gravitron cannot calculate bias unless a data file is loaded that covers the times of the recorded height measurements. However, the resulting bias calculation will not be meaningful at all.


\section{Why do we take gravity ties?}
If you're curious as to why you are being asked to spend 90+ minutes making water height measurements and clicking buttons on your computer, here's a quick explanation of what gravity ties are for.

Expand Down
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@
<p id="landTieStat">Land tie:</p>
</div>
<div>
<p id="statusText"></p>
<p id="statusText">[status message]</p>
</div>
<div>
<p id="debugStatus">debug off</p>
</div>
<div class="container">
<canvas id="myChart" width="200" height="200"></canvas>
Expand Down
13 changes: 13 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ const fs = require('node:fs')

let mainWindow;

// path for resources; switch depending on whether running packaged or not
const resPath = app.isPackaged ? process.resourcesPath : __dirname;

// debug mode bool: if true, timestamps for heights are pulled from DGS file so calculation
// can be run using any test data file.
let debugMode = false;

// main window-creating function!
function createWindow () {
mainWindow = new BrowserWindow({
Expand All @@ -21,6 +27,13 @@ function createWindow () {
{
label: 'File ',
submenu: [
{
label: 'Debug mode on/off',
click: () => {
debugMode = !debugMode;
mainWindow.webContents.send('toggle-debug', debugMode);
}
},
{
label: 'Close ',
accelerator: 'Ctrl+W',
Expand Down
1 change: 1 addition & 0 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ contextBridge.exposeInMainWorld('electronAPI', {
sendTieToMain: (data) => ipcRenderer.send('tie-data-kv-object', data),
openReadTOML: () => ipcRenderer.invoke('open-read-toml'),
returnToml: (callback) => ipcRenderer.on('tomlread',(event, content) => callback(content)),
toggleDebug: (callback) => ipcRenderer.on('toggle-debug',callback),
})
12 changes: 11 additions & 1 deletion renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const faafactor = 0.3086;
const gravcal = 414125;
const otherfactor = 8388607;
const g0 = 10000;
const isDebug = true;
let isDebug = false;

const statmessage = document.getElementById('statusText'); // FOR TESTING ONLY

Expand Down Expand Up @@ -129,6 +129,16 @@ class TieData {
// create the tieData object
const tieData = new TieData();

// try to get debug status
window.electronAPI.toggleDebug((event, debugStatus) => {
isDebug = debugStatus;
if (isDebug) {
document.getElementById("debugStatus").textContent = 'debug on';
} else {
document.getElementById("debugStatus").textContent = 'debug off';
}
})


////////////////////////////////////////////////////////////////////////
// tie metadata, general
Expand Down

0 comments on commit daacfa2

Please # to comment.