Error Handling: outofmem issue
Posted: Sun Nov 19, 2023 2:47 am
Environment
Version: Love 11.3
Platform: Raspberry Pi 4 Model B+ (8GB Ram)
System: 32-bit
Kernel version: 6.1
Debian version: 12 (bookworm)
External Requirements
libgphoto2 (external camera control)
lua-periphery (GPIO control)
nativefs (accessing external directories) [included in the archive]
Program Function
Loop a short video while in Idle State.
Receive a signal from a NA-M7RF laser to trigger the capture of an external camera.
Save the JPEG to disk, overwriting any previous JPEGs taken.
Load the new JPEG into the program.
Display the JPEG for 20 seconds.
Return the Idle State.
Error
lib/assetloader.lua 38: Could not decode image with stb_image (outofmem)
That line of code is just: self.cameraImage = love.graphics.newImage("MyFilePath")
assetloader.cameraImage is only used in Draw() by graphics.draw() while in the CameraWait state (See Notes Below)
Notes
Update() and Draw() are written as a basic State Machine.
The program has 4 states: IdleImage, IdleVideo, CameraCapture, and CameraWait
The program should Idle on either IdleImage or IdleVideo (IdleImage is only set if the program can not load the video.)
When the Idle states get a signal from the Laser, it swaps over to CameraCapture where it checks to see if the External Camera saved the image to disk.
If it did not, then it just goes back to Idle. Otherwise it will swap to CameraWait for 20 seconds displaying the new image taken, then it goes back to Idle.
Version: Love 11.3
Platform: Raspberry Pi 4 Model B+ (8GB Ram)
System: 32-bit
Kernel version: 6.1
Debian version: 12 (bookworm)
External Requirements
libgphoto2 (external camera control)
lua-periphery (GPIO control)
nativefs (accessing external directories) [included in the archive]
Program Function
Loop a short video while in Idle State.
Receive a signal from a NA-M7RF laser to trigger the capture of an external camera.
Save the JPEG to disk, overwriting any previous JPEGs taken.
Load the new JPEG into the program.
Display the JPEG for 20 seconds.
Return the Idle State.
Error
lib/assetloader.lua 38: Could not decode image with stb_image (outofmem)
That line of code is just: self.cameraImage = love.graphics.newImage("MyFilePath")
assetloader.cameraImage is only used in Draw() by graphics.draw() while in the CameraWait state (See Notes Below)
Notes
Update() and Draw() are written as a basic State Machine.
The program has 4 states: IdleImage, IdleVideo, CameraCapture, and CameraWait
The program should Idle on either IdleImage or IdleVideo (IdleImage is only set if the program can not load the video.)
When the Idle states get a signal from the Laser, it swaps over to CameraCapture where it checks to see if the External Camera saved the image to disk.
If it did not, then it just goes back to Idle. Otherwise it will swap to CameraWait for 20 seconds displaying the new image taken, then it goes back to Idle.