Taking WiPhone Screenshots

WiPhone enables users to take screenshot of any activity screen through simple method. This guide illustrates how user can take screenshots in WiPhone.

How to Do this in Firmware

There is a function in WiPhone firmware to take the screenshot of WiPhone display. To enable this function follow the steps below:

  1. comment #define WIPHONE_PRODUCTION and #define DIAGNOSTICS_ONLY in config.h
  2. uncomment #define STEAL_THE_USER_BUTTONS in config.h

In WiPhone.ino, Comment out every thing and just uncomment these two lines `gui.setDumpRegion(); gui.frameToSerial();

      if (keyPressed == WIPHONE_KEY_F4) {
//        //esp_sleep_enable_ext0_wakeup((gpio_num_t)KEYBOARD_INTERRUPT_PIN,1);
//        //esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK, ESP_EXT1_WAKEUP_ANY_HIGH);
//        esp_sleep_enable_ext0_wakeup((gpio_num_t)KEYBOARD_INTERRUPT_PIN,0); //1 = Low to High, 0 = High to Low. Pin pulled HIGH
//        //esp_sleep_enable_timer_wakeup(5000000);
//        log_d("begin delay");
//        delay(500); // debounce
//        log_d("begin light sleep");
//        delay(10); // let print finish
//        //esp_deep_sleep_start();
//        esp_light_sleep_start();
//        log_d("awake!!!");

        //LOG_MEM_STATUS;

        gui.setDumpRegion();
        gui.frameToSerial();    // "screenshot"
      }
#endif

Now compile and upload the code to WiPhone with settings; ** Core Debug Level: None**

_images/debugNone.png

Note

If you compile your code with Core Debug Levels other than specified, extra text/ info will get print with screenshot and you will need to delete these from screenshot data before convert it into image.*

Now open the Arduino Serial Monitor and go to the desired screen on WiPhone. Press F4 User key (Here we will be taking screenshot of custom bootscreen). You will see data printing out to serial monitor. Wait until data is printing, then copy that data to a text file with filename as screenshot.txt

_images/ArduinoSerial.png

After placing the data to .txt file, Remove any empty lines. One way to do this is with Notepad++ text editor.

  • Edit -> Line Operations -> Remove Empty Lines*
_images/RemoveEmptyLines.png

Now place the screenshot.txt to \WiPhone\tools\screenshot and run array2png.py script. After successful execution you will see output.png as recorded screenshot.

Note

Python 2 is required for array2png.py script.

_images/output.png