Fix simulator (#3360)
* fix simulator * print out halt reason * option to close simulator after time * workflow calls it * test with the bug still present * ...and fix the bug
This commit is contained in:
parent
4863d5ae71
commit
56afeb17c8
|
@ -31,6 +31,10 @@ jobs:
|
||||||
working-directory: ./simulator/
|
working-directory: ./simulator/
|
||||||
run: bash compile.sh
|
run: bash compile.sh
|
||||||
|
|
||||||
|
- name: Run Simulator (10 seconds)
|
||||||
|
working-directory: ./simulator/
|
||||||
|
run: ./build/rusefi_simulator 10
|
||||||
|
|
||||||
- name: Upload built simulator
|
- name: Upload built simulator
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -92,6 +92,8 @@ void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, acti
|
||||||
}
|
}
|
||||||
|
|
||||||
void SleepExecutor::cancel(scheduling_s* s) {
|
void SleepExecutor::cancel(scheduling_s* s) {
|
||||||
|
chibios_rt::CriticalSectionLocker csl;
|
||||||
|
|
||||||
if (chVTIsArmedI(&s->timer)) {
|
if (chVTIsArmedI(&s->timer)) {
|
||||||
chVTResetI(&s->timer);
|
chVTResetI(&s->timer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -727,7 +727,7 @@
|
||||||
* the system is halted.
|
* the system is halted.
|
||||||
*/
|
*/
|
||||||
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||||
printf("chSysHalt\r\n"); \
|
printf("chSysHalt: %s\r\n", reason); \
|
||||||
exit(-1); \
|
exit(-1); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,10 +129,12 @@ static evhandler_t fhandlers[] = { termination_handler, sd1_handler, sd2_handler
|
||||||
|
|
||||||
bool verboseMode = true;
|
bool verboseMode = true;
|
||||||
|
|
||||||
|
static virtual_timer_t exitTimer;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*
|
/*------------------------------------------------------------------------*
|
||||||
* Simulator main. *
|
* Simulator main. *
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
int main(void) {
|
int main(int argc, char** argv) {
|
||||||
/*
|
/*
|
||||||
* System initializations.
|
* System initializations.
|
||||||
* - HAL initialization, this also initializes the configured device drivers
|
* - HAL initialization, this also initializes the configured device drivers
|
||||||
|
@ -143,6 +145,15 @@ int main(void) {
|
||||||
halInit();
|
halInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
|
if (argc == 2) {
|
||||||
|
int timeoutSeconds = atoi(argv[1]);
|
||||||
|
printf("Running rusEFI simulator for %d seconds, then exiting.\n\n", timeoutSeconds);
|
||||||
|
|
||||||
|
chSysLock();
|
||||||
|
chVTSetI(&exitTimer, MY_US2ST(timeoutSeconds * 1e6), &exit, 0);
|
||||||
|
chSysUnlock();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Console thread started.
|
* Console thread started.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue