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
5cee1b6131
commit
efa08b329d
|
@ -31,6 +31,10 @@ jobs:
|
|||
working-directory: ./simulator/
|
||||
run: bash compile.sh
|
||||
|
||||
- name: Run Simulator (10 seconds)
|
||||
working-directory: ./simulator/
|
||||
run: ./build/rusefi_simulator 10
|
||||
|
||||
- name: Upload built simulator
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
|
|
@ -92,6 +92,8 @@ void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, acti
|
|||
}
|
||||
|
||||
void SleepExecutor::cancel(scheduling_s* s) {
|
||||
chibios_rt::CriticalSectionLocker csl;
|
||||
|
||||
if (chVTIsArmedI(&s->timer)) {
|
||||
chVTResetI(&s->timer);
|
||||
}
|
||||
|
|
|
@ -727,7 +727,7 @@
|
|||
* the system is halted.
|
||||
*/
|
||||
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
|
||||
printf("chSysHalt\r\n"); \
|
||||
printf("chSysHalt: %s\r\n", reason); \
|
||||
exit(-1); \
|
||||
}
|
||||
|
||||
|
|
|
@ -129,10 +129,12 @@ static evhandler_t fhandlers[] = { termination_handler, sd1_handler, sd2_handler
|
|||
|
||||
bool verboseMode = true;
|
||||
|
||||
static virtual_timer_t exitTimer;
|
||||
|
||||
/*------------------------------------------------------------------------*
|
||||
* Simulator main. *
|
||||
*------------------------------------------------------------------------*/
|
||||
int main(void) {
|
||||
int main(int argc, char** argv) {
|
||||
/*
|
||||
* System initializations.
|
||||
* - HAL initialization, this also initializes the configured device drivers
|
||||
|
@ -143,6 +145,15 @@ int main(void) {
|
|||
halInit();
|
||||
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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue