mirror of
https://github.com/peterantypas/maiana.git
synced 2025-05-19 00:40:08 -07:00
Resetting MCU every hour
This commit is contained in:
parent
4613466268
commit
529f6f05ca
@ -459,7 +459,7 @@
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.target.other.1597884643" name="Other target flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.target.other" useByScannerDiscovery="true"/>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.364488473" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.more" valueType="enumerated"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.364488473" name="Optimization Level" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.level.size" valueType="enumerated"/>
|
||||
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength.751072022" name="Message length (-fmessage-length=0)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.optimization.messagelength" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
virtual ~RFIC();
|
||||
|
||||
void setRSSIAdjustment(short rssiAdj);
|
||||
uint16_t partNumber();
|
||||
protected:
|
||||
virtual void configure();
|
||||
bool sendCmd(uint8_t cmd, void* params, uint8_t paramLen, void* result, uint8_t resultLen);
|
||||
|
@ -58,7 +58,8 @@ private:
|
||||
Transceiver *mTransceiverIC;
|
||||
Receiver *mReceiverIC;
|
||||
bool mInitializing;
|
||||
time_t mUTC;
|
||||
time_t mUTC = 0;
|
||||
time_t mStartTime = 0;
|
||||
|
||||
CircularQueue<TXPacket*> mTXQueue;
|
||||
};
|
||||
|
@ -225,6 +225,16 @@ def boot(address):
|
||||
return True
|
||||
|
||||
|
||||
def enter_dfu(portname):
|
||||
p = serial.Serial(portname, 38400, timeout=2, parity=serial.PARITY_NONE, stopbits=1)
|
||||
if not p.is_open:
|
||||
return False
|
||||
|
||||
p.write('dfu\r\n')
|
||||
time.sleep(1)
|
||||
s = p.readline()
|
||||
p.close()
|
||||
return len(s) == 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 4:
|
||||
@ -247,6 +257,10 @@ if __name__ == '__main__':
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if not enter_dfu(sys.argv[1]):
|
||||
print "Could not enter DFU mode"
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
port = serial.Serial(sys.argv[1], BAUD_RATE, timeout=2, parity=serial.PARITY_EVEN, stopbits=1)
|
||||
if not port.is_open:
|
||||
|
@ -39,6 +39,7 @@ RFIC::RFIC(GPIO_TypeDef *sdnPort,
|
||||
mCSPort = csPort;
|
||||
mDataPort = dataPort;
|
||||
mClockGPIO = clockPort;
|
||||
mPartNumber = 0;
|
||||
|
||||
mSDNPin = sdnPin;
|
||||
mCSPin = csPin;
|
||||
@ -178,6 +179,11 @@ void RFIC::configure()
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t RFIC::partNumber()
|
||||
{
|
||||
return mPartNumber;
|
||||
}
|
||||
|
||||
bool RFIC::isInitialized()
|
||||
{
|
||||
HAL_GPIO_WritePin(mSDNP, mSDNPin, GPIO_PIN_SET);
|
||||
|
@ -107,10 +107,12 @@ void RadioManager::processEvent(const Event &e)
|
||||
{
|
||||
mUTC = e.clock.utc;
|
||||
|
||||
// Evaluate the state of the transceiver IC and our queue ...
|
||||
if ( mTransceiverIC->assignedTXPacket() == NULL )
|
||||
if ( mStartTime == 0 )
|
||||
{
|
||||
if ( !mTXQueue.empty() )
|
||||
mStartTime = mUTC;
|
||||
}
|
||||
|
||||
if ( !mTXQueue.empty() && mTransceiverIC->assignedTXPacket() == NULL )
|
||||
{
|
||||
// There is no current TX operation pending, so we assign one
|
||||
TXPacket *packet = NULL;
|
||||
@ -133,8 +135,17 @@ void RadioManager::processEvent(const Event &e)
|
||||
// The transceiver will switch channel if the packet channel is different
|
||||
mTransceiverIC->assignTXPacket(packet);
|
||||
}
|
||||
else if ( mUTC - mStartTime >= 3600 )
|
||||
{
|
||||
/**
|
||||
* For some reason, RX performance seems to go downhill after many hours
|
||||
* of continuous operation, so the easiest remedy is to reboot every hour.
|
||||
* The impact of this is pretty small.
|
||||
*/
|
||||
|
||||
bsp_reboot();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
VHFChannel RadioManager::alternateChannel(VHFChannel channel)
|
||||
|
@ -126,7 +126,7 @@ void bsp_hw_init()
|
||||
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
HAL_UART_Init(&huart1);
|
||||
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 7, 0);
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 1, 0);
|
||||
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||
__HAL_UART_ENABLE_IT(&huart1, UART_IT_RXNE);
|
||||
|
||||
|
@ -123,7 +123,7 @@ void bsp_hw_init()
|
||||
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
|
||||
HAL_UART_Init(&huart1);
|
||||
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 7, 0);
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 1, 0);
|
||||
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||
__HAL_UART_ENABLE_IT(&huart1, UART_IT_RXNE);
|
||||
|
||||
|
@ -56,8 +56,8 @@ void mainLoop()
|
||||
EventPool::instance().init();
|
||||
EventQueue::instance().init();
|
||||
Configuration::instance().init();
|
||||
CommandProcessor::instance().init();
|
||||
DataTerminal::instance().init();
|
||||
CommandProcessor::instance().init();
|
||||
|
||||
RXPacketProcessor packetProcessor;
|
||||
GPS::instance().init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user