diff --git a/src/kernel/Init.hx b/src/kernel/Init.hx index 03ea972..c72a407 100644 --- a/src/kernel/Init.hx +++ b/src/kernel/Init.hx @@ -45,7 +45,7 @@ class Init { // Register default terminate handler KernelEvents.instance.onTerminate.handle(_->{ - OS.reboot(); + KernelEvents.instance.shutdown(); }); Debug.printBuildInfo(); diff --git a/src/kernel/KernelEvents.hx b/src/kernel/KernelEvents.hx index b8dd6bf..40498f7 100644 --- a/src/kernel/KernelEvents.hx +++ b/src/kernel/KernelEvents.hx @@ -1,7 +1,6 @@ package kernel; -import haxe.MainLoop; -import cc.OS; +import kernel.peripherals.Peripherals.Peripheral; import kernel.log.Log; import lib.Pos; import cc.HTTP.HTTPResponse; @@ -150,6 +149,12 @@ class KernelEvents { } public function shutdown() { + + // clearing screens + for (screen in Peripheral.instance.getAllScreens()) { + screen.reset(); + } + Log.info('Shutting down event loop'); this.stopLoop = true; MainTerm.instance.reset();