/**
 **************************************************
 * @file        Inkplate6_Image_Converter.ino
 * @brief       Example showing how to display an image on Inkplate 6
 *              using the Soldered Image Converter tool.
 *
 * @details     This example demonstrates how to use the Soldered Image
 *              Converter to prepare an image for display on Inkplate 6.
 *              The tool converts any image into a C byte array stored in
 *              a header file (.h) which can be directly included in your
 *              Arduino sketch.
 *
 *              Tool workflow:
 *              1. Open the Image Converter at https://tools.soldered.com/tools/image-converter/
 *              2. Upload your image and select "Inkplate 6" as the target board.
 *              3. Choose the display mode:
 *                 - 1-bit (Black & White) — fastest refresh, highest contrast
 *                 - 3-bit (Grayscale) — 8 shades of gray
 *              4. Adjust dithering, resize, and other options as needed.
 *              5. Save the generated header file (image.h) and place it
 *                 in the same folder as this sketch.
 *
 * Requirements:
 * - Board:      Soldered Inkplate 6
 * - Hardware:   Inkplate 6, USB cable
 * - Extra:      The image header file (image.h) generated by the tool
 *
 * Configuration:
 * - Boards Manager -> Inkplate Boards -> Soldered Inkplate6
 *
 * Don't have Inkplate Boards in Arduino Boards Manager?
 * See https://docs.soldered.com/inkplate/6/quick-start-guide/
 *
 * How to use:
 * 1) Generate image.h using the Image Converter at https://tools.soldered.com/tools/image-converter/
 * 2) Place image.h in the same folder as this sketch.
 * 3) Select "e-radionica Inkplate6 or Soldered Inkplate6" from Tools → Board.
 * 4) Upload the sketch to Inkplate 6.
 * 5) The image appears on the display after initialization.
 *
 * Expected output:
 * - Your converted image displayed on the Inkplate 6 e-paper screen.
 *
 * Notes:
 * - image_w and image_h are automatically defined in the generated image.h.
 * - For grayscale mode use INKPLATE_3BIT instead of INKPLATE_1BIT.
 * - display.clearDisplay() clears only the internal framebuffer.
 * - display.display() must be called to push the framebuffer to the screen.
 *
 * Docs:         https://docs.soldered.com/inkplate
 * Support:      https://soldered.com/pages/contact
 * Image tool:   https://tools.soldered.com/tools/image-converter/
 *
 * @author      Soldered
 * @date        April 2026
 * @license     GNU GPL V3
 **************************************************/

// Next 3 lines are a precaution, you can ignore those, and the example would also work without them
#if !defined(ARDUINO_ESP32_DEV) && !defined(ARDUINO_INKPLATE6V2)
#error "Wrong board selection for this example, please select e-radionica Inkplate6 or Soldered Inkplate6 in the boards menu."
#endif

#include "Inkplate.h" // Include the Inkplate library
#include "image.h"    // Include the image header generated by the Image Converter tool

Inkplate display(INKPLATE_1BIT); // 1-bit mode (black & white)
//Inkplate display(INKPLATE_3BIT); // Uncomment for 3-bit mode (grayscale, 8 shades)

void setup() {
    display.begin();        // Initialize the display hardware
    display.clearDisplay(); // Clear the frame buffer (does NOT clear the physical screen)

    display.image.draw(image, 0, 0, image_w, image_h); // Arguments are: array variable name, start X, start Y,  size X, size Y

    display.display(); // Refresh the e-paper display to show the image
}

void loop() {
    // No code needed here for this example
}
