From 3806bd1f5ce56afdbb4cc0c1ed54d53e25603be2 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Mon, 25 Aug 2025 03:05:35 +0000 Subject: Improves `hsm-cam` - Moves C++ constants to Haskell side - Uses better names for request callback related variables - Captures and redirects libcamera's internal logging --- hsm-cam/Test/Cam.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'hsm-cam/Test/Cam.hs') diff --git a/hsm-cam/Test/Cam.hs b/hsm-cam/Test/Cam.hs index 9b06785..fc56b6c 100644 --- a/hsm-cam/Test/Cam.hs +++ b/hsm-cam/Test/Cam.hs @@ -1,16 +1,11 @@ import Control.Monad (forM_) import Data.ByteString.Lazy (writeFile) -import Data.Function ((&)) import Effectful (liftIO, runEff) import Hsm.Cam (capturePng, runCam) -import Hsm.Log (Severity(Info, Trace), logMsg, runLog) +import Hsm.Log (Severity(Info, Trace), runLog) import Prelude hiding (writeFile) main :: IO () -main = forM_ [0 .. 31] savePng & runCam & runLog @"cam" Trace & runEff - where - savePng index = do - logMsg Info $ "Saving image to file: " <> path - capturePng >>= liftIO . writeFile path - where - path = "/tmp/hsm-cam-test" <> show @Int index <> ".png" +main = + runEff . runLog @"cam" Trace . runLog @"libcamera" Info . runCam . forM_ [0 .. 31] $ \index -> + capturePng >>= liftIO . writeFile ("/tmp/hsm-cam-test" <> show @Int index <> ".png") -- cgit v1.2.1