mirror of
https://github.com/peterantypas/maiana.git
synced 2025-05-28 05:10:40 -07:00
sentence
This commit is contained in:
parent
18e14fe4c7
commit
94dd635b3c
@ -48,6 +48,9 @@ public:
|
||||
const OTPData *readOTP();
|
||||
bool writeOTP(const OTPData &data);
|
||||
void reportSystemData();
|
||||
void enableTX();
|
||||
void disableTX();
|
||||
bool isTXEnabled();
|
||||
private:
|
||||
Configuration();
|
||||
bool erasePage();
|
||||
|
@ -26,11 +26,14 @@ public:
|
||||
void queueMessage18(VHFChannel channel);
|
||||
void queueMessage24(VHFChannel channel);
|
||||
|
||||
void reportTXStatus();
|
||||
|
||||
private:
|
||||
TXScheduler ();
|
||||
virtual ~TXScheduler ();
|
||||
time_t positionReportTimeInterval();
|
||||
void sendNMEASentence(const char *sentence);
|
||||
bool isTXAllowed();
|
||||
private:
|
||||
VHFChannel mPositionReportChannel;
|
||||
VHFChannel mStaticDataChannel;
|
||||
|
@ -151,7 +151,7 @@ void CommandProcessor::processCommand(const char *buff)
|
||||
}
|
||||
else if ( s.find("tx?") == 0 )
|
||||
{
|
||||
// TODO
|
||||
TXScheduler::instance().reportTXStatus();
|
||||
}
|
||||
else if (s.find("reboot") == 0 )
|
||||
{
|
||||
|
@ -62,12 +62,26 @@ void Configuration::init()
|
||||
bool cliBootMode = *(uint32_t*)BOOTMODE_ADDRESS == CLI_FLAG_MAGIC;
|
||||
if ( !cliBootMode )
|
||||
{
|
||||
//reportOTPData();
|
||||
reportSystemData();
|
||||
reportStationData();
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::enableTX()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void Configuration::disableTX()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool Configuration::isTXEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *Configuration::hwRev()
|
||||
{
|
||||
const OTPData *otp = readOTP();
|
||||
|
@ -62,12 +62,39 @@ TXScheduler::TXScheduler ()
|
||||
|
||||
void TXScheduler::init()
|
||||
{
|
||||
reportTXStatus();
|
||||
}
|
||||
|
||||
TXScheduler::~TXScheduler ()
|
||||
{
|
||||
}
|
||||
|
||||
void TXScheduler::reportTXStatus()
|
||||
{
|
||||
bool hwSwitchOff = bsp_is_tx_disabled();
|
||||
bool softSwitch = Configuration::instance().isTXEnabled();
|
||||
bool hasStation = Configuration::instance().isStationDataProvisioned();
|
||||
|
||||
bool status = hwSwitchOff ? false : (softSwitch && hasStation);
|
||||
|
||||
Event *e = EventPool::instance().newEvent(PROPR_NMEA_SENTENCE);
|
||||
if ( !e )
|
||||
return;
|
||||
|
||||
sprintf(e->nmeaBuffer.sentence, "$PAITXCFG,%d,%d,%d,%d*", !hwSwitchOff, softSwitch, hasStation, status);
|
||||
Utils::completeNMEA(e->nmeaBuffer.sentence);
|
||||
EventQueue::instance().push(e);
|
||||
}
|
||||
|
||||
bool TXScheduler::isTXAllowed()
|
||||
{
|
||||
bool hwSwitchOff = bsp_is_tx_disabled();
|
||||
bool softSwitch = Configuration::instance().isTXEnabled();
|
||||
bool hasStation = Configuration::instance().isStationDataProvisioned();
|
||||
|
||||
return hwSwitchOff ? false : (softSwitch && hasStation);
|
||||
}
|
||||
|
||||
void TXScheduler::processEvent(const Event &e)
|
||||
{
|
||||
switch(e.type)
|
||||
@ -89,7 +116,7 @@ void TXScheduler::processEvent(const Event &e)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ( bsp_is_tx_disabled() )
|
||||
if ( !isTXAllowed() )
|
||||
return;
|
||||
|
||||
|
||||
@ -127,7 +154,10 @@ void TXScheduler::processEvent(const Event &e)
|
||||
|
||||
mUTC = e.clock.utc;
|
||||
|
||||
//DBG("Clock Event\r\n");
|
||||
// Every minute on the minute ...
|
||||
if ( mUTC % 60 == 0 )
|
||||
reportTXStatus();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user