mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Breaking out the main init and main loop to allow for offline testing
This commit is contained in:
parent
cb39345dd3
commit
faf1c9a6d2
1 changed files with 16 additions and 5 deletions
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
#include "common/color.h"
|
#include "common/color.h"
|
||||||
#include "common/atomic.h"
|
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
|
|
||||||
#include "drivers/nvic.h"
|
#include "drivers/nvic.h"
|
||||||
|
@ -658,7 +657,7 @@ void processLoopback(void) {
|
||||||
#define processLoopback()
|
#define processLoopback()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int main(void) {
|
void main_init(void) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
/* Setup scheduler */
|
/* Setup scheduler */
|
||||||
|
@ -729,12 +728,24 @@ int main(void) {
|
||||||
#ifdef USE_BST
|
#ifdef USE_BST
|
||||||
setTaskEnabled(TASK_BST_MASTER_PROCESS, true);
|
setTaskEnabled(TASK_BST_MASTER_PROCESS, true);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
void main_step(void)
|
||||||
scheduler();
|
{
|
||||||
processLoopback();
|
scheduler();
|
||||||
|
processLoopback();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NOMAIN
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
main_init();
|
||||||
|
while(1) {
|
||||||
|
main_step();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_HARDFAULTS
|
#ifdef DEBUG_HARDFAULTS
|
||||||
//from: https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
|
//from: https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue