summaryrefslogtreecommitdiff
path: root/map65/astro.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2022-12-04 22:15:46 +0100
committerChristoph Berg <myon@debian.org>2022-12-04 22:15:46 +0100
commit720f65addc6e7039817074330332b1a2b3110dc3 (patch)
tree23e67126ac6495e4fc0cb6c59f845f98468ae1b2 /map65/astro.cpp
parent7fade58d254e231b623febf3d303c108cd03e805 (diff)
parentfa73b3f50ec6ead52c3371a96f62bc6e666a9ee5 (diff)
Update upstream source from tag 'upstream/2.6.0_rc5+repack'
Update to upstream version '2.6.0~rc5+repack' with Debian dir e1472b5b51a5aa5dbb8c6e570a987179dd626bfc
Diffstat (limited to 'map65/astro.cpp')
-rwxr-xr-xmap65/astro.cpp75
1 files changed, 73 insertions, 2 deletions
diff --git a/map65/astro.cpp b/map65/astro.cpp
index 6282c18e..b9476883 100755
--- a/map65/astro.cpp
+++ b/map65/astro.cpp
@@ -7,6 +7,7 @@
#include <stdio.h>
#include "SettingsGroup.hpp"
#include "commons.h"
+#include <math.h>
extern "C" {
void astrosub_ (int* nyear, int* month, int* nday, double* uth, int* nfreq,
@@ -44,7 +45,7 @@ Astro::~Astro()
}
void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
- int fQSO, int nsetftx, int ntxFreq, QString azelDir)
+ int fQSO, int nsetftx, int ntxFreq, QString azelDir, double xavg)
{
static int ntxFreq0=-99;
char cc[300];
@@ -86,6 +87,65 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
ntsky,xnr,dgrd);
ui->astroTextBrowser->setText(" "+ date + "\nUTC: " + utc + "\n" + cc);
+ double azOffset=0.0;
+ double elOffset=0.0;
+ double rad=57.2957795131;
+ int iCycle=2;
+// Are we doing pointing tests?
+ bool bPointing=ui->cbPointingTests->isChecked();
+ ui->gbPointing->setVisible(bPointing);
+ if(bPointing) {
+ int nDwell=int(ui->sbDwell->value());
+ if(ui->cbAutoCycle->isChecked()) {
+ iCycle=(t.currentSecsSinceEpoch()%(6*nDwell))/nDwell + 1;
+ if(iCycle==1) {
+ azOffset = -ui->sbOffset->value()/cos(elsun/rad);
+ ui->rb1->setChecked(true);
+ }
+ if(iCycle==2 or iCycle==5) {
+ ui->rb2->setChecked(true);
+ }
+ if(iCycle==3) {
+ azOffset = +ui->sbOffset->value()/cos(elsun/rad);
+ ui->rb3->setChecked(true);
+ }
+ if(iCycle==4) {
+ elOffset = -ui->sbOffset->value();
+ ui->rb4->setChecked(true);
+ }
+ if(iCycle==6) {
+ elOffset = +ui->sbOffset->value();
+ ui->rb6->setChecked(true);
+ }
+ }
+ if(ui->cbOnOff->isChecked()) {
+ iCycle=(t.currentSecsSinceEpoch()%(2*nDwell))/nDwell + 1;
+ if(iCycle==1) {
+ azOffset = -ui->sbOffset->value()/cos(elsun/rad);
+ ui->rb1->setChecked(true);
+ }
+ if(iCycle==2) {
+ ui->rb2->setChecked(true);
+ }
+ }
+ if(ui->cbAutoCycle->isChecked() or ui->cbOnOff->isChecked()) {
+ QFile f("pointing.out");
+ if(f.open(QIODevice::WriteOnly | QIODevice::Append)) {
+ QTextStream out(&f);
+ out << t.toString("yyyy-MMM-dd hh:mm:ss");
+ sprintf(cc,"%7.1f %7.1f %d %7.1f %7.1f %10.1f %7.2f\n",
+ azsun,elsun,iCycle,azOffset,elOffset,xavg,10.0*log10(xavg));
+ out << cc;
+ f.close();
+ }
+ }
+ } else {
+ ui->rb2->setChecked(true);
+ ui->cbAutoCycle->setChecked(false);
+ ui->cbOnOff->setChecked(false);
+ }
+
+// Write pointing data to azel.dat
QString fname=azelDir+"/azel.dat";
QFile f(fname);
if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
@@ -107,7 +167,7 @@ void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid,
"%3d,%1d,fQSO\n"
"%3d,%1d,fQSO2\n",
nhr,nmin,isec,azmoon,elmoon,
- nhr,nmin,isec,azsun,elsun,
+ nhr,nmin,isec,azsun+azOffset,elsun+elOffset,
nhr,nmin,isec,0.0,0.0,
nfreq,ndop,ndop00,
fQSO,nsetftx,
@@ -120,3 +180,14 @@ void Astro::setFontSize(int n)
{
ui->astroTextBrowser->setFontPointSize(n);
}
+
+void Astro::on_cbAutoCycle_clicked(bool checked)
+{
+ if(checked) ui->cbOnOff->setChecked(false);
+}
+
+void Astro::on_cbOnOff_clicked(bool checked)
+{
+ if(checked) ui->cbAutoCycle->setChecked(false);
+}
+