mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-05 22:45:23 +00:00
app: refactor tasks creation
This commit is contained in:
parent
e44ed8473c
commit
49d76ca9cc
2 changed files with 33 additions and 21 deletions
|
|
@ -27,6 +27,7 @@
|
|||
static Protocol::PacketInfo recv_packet;
|
||||
static Protocol::PacketInfo last_measure_packet; // contains the command that started the last measured (replay in case of timeout)
|
||||
static TaskHandle_t handle;
|
||||
static bool sweepActive;
|
||||
|
||||
#if HW_REVISION >= 'B'
|
||||
// has MCU controllable flash chip, firmware update supported
|
||||
|
|
@ -45,7 +46,7 @@ static void USBPacketReceived(const Protocol::PacketInfo &p) {
|
|||
portYIELD_FROM_ISR(woken);
|
||||
}
|
||||
|
||||
void App_Start() {
|
||||
inline void App_Init() {
|
||||
STM::Init();
|
||||
HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);
|
||||
handle = xTaskGetCurrentTaskHandle();
|
||||
|
|
@ -98,10 +99,13 @@ void App_Start() {
|
|||
USB_EN_GPIO_Port->BSRR = USB_EN_Pin;
|
||||
#endif
|
||||
|
||||
bool sweepActive = false;
|
||||
|
||||
LED::Off();
|
||||
while (1) {
|
||||
|
||||
sweepActive = false;
|
||||
}
|
||||
|
||||
inline void App_Process() {
|
||||
while(1) {
|
||||
uint32_t notification;
|
||||
if(xTaskNotifyWait(0x00, UINT32_MAX, ¬ification, 100) == pdPASS) {
|
||||
// something happened
|
||||
|
|
@ -153,7 +157,7 @@ void App_Start() {
|
|||
sweepActive = false;
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
#ifdef HAS_FLASH
|
||||
#ifdef HAS_FLASH
|
||||
case Protocol::PacketType::ClearFlash:
|
||||
HW::SetMode(HW::Mode::Idle);
|
||||
sweepActive = false;
|
||||
|
|
@ -188,7 +192,7 @@ void App_Start() {
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case Protocol::PacketType::RequestSourceCal:
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
Cal::SendSource();
|
||||
|
|
@ -232,3 +236,8 @@ void App_Start() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void App_Start() {
|
||||
App_Init();
|
||||
App_Process();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue