From 52016defd5047e44584cc784e7d2f2fe6cbe296d Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 19 Feb 2016 15:34:02 -0800 Subject: [PATCH] Capture screen image, save to PNG file on SD card. --- firmware/application/Makefile | 1 + firmware/application/ui_navigation.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/firmware/application/Makefile b/firmware/application/Makefile index 37f1a4f0..6969eb19 100755 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -180,6 +180,7 @@ CPPSRC = main.cpp \ sd_card.cpp \ file.cpp \ log_file.cpp \ + png_writer.cpp \ manchester.cpp \ string_format.cpp \ temperature_logger.cpp \ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index c298da18..ee725801 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -34,6 +34,8 @@ #include "core_control.hpp" +#include "png_writer.hpp" + namespace ui { /* SystemStatusView ******************************************************/ @@ -77,6 +79,13 @@ void SystemStatusView::set_title(const std::string new_value) { } void SystemStatusView::on_camera() { + PNGWriter png { "capture.png" }; + + for(int i=0; i<320; i++) { + std::array row; + portapack::display.read_pixels({ 0, i, 240, 1 }, row); + png.write_scanline(row); + } } /* Navigation ************************************************************/