update screenshot, webserver und README.md

This commit is contained in:
sharandac
2020-07-10 09:35:51 +02:00
parent 2994b21daf
commit 50906523c2
13 changed files with 28 additions and 39 deletions

View File

@@ -1 +1,22 @@
# My-TTGO-Watch
A smartwatch based on ESP32 from LlyGo. Currently under development.
# Install
Clone this repository and open it with platformIO. Build and upload. On a terminal in vscode you can do it with
```bash
pio run -t upload
```
# Interface
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen1.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen2.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen3.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen4.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen5.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen6.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen7.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen8.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen9.png)
![screenshot](https://github.com/sharandac/My-TTGO-Watch/blob/master/images/screen10.png)

BIN
images/screen1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
images/screen10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/screen2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
images/screen3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
images/screen4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
images/screen5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
images/screen6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/screen7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
images/screen8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
images/screen9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -1,64 +1,32 @@
#include "config.h"
#include <TTGO.h>
#include "screenshot.h"
#include <rom/crc.h>
#include <endian.h>
lv_disp_drv_t screenshot_disp_drv;
static lv_disp_buf_t screenshot_disp_buf;
static lv_color_t screenshot_buf1[ LV_HOR_RES_MAX * 1 ];
lv_disp_t *system_disp;
lv_disp_t *screenshot_disp;
uint16_t *png;
volatile bool screenshot = false;
static void screenshot_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p );
void screenshot_setup( void ) {
png = (uint16_t*)ps_malloc( LV_HOR_RES_MAX * LV_VER_RES_MAX * 2 );
system_disp = lv_disp_get_default();
lv_disp_drv_init( &screenshot_disp_drv );
lv_disp_buf_init( &screenshot_disp_buf, screenshot_buf1, NULL, LV_HOR_RES_MAX * 1 );
screenshot_disp_drv.hor_res = TFT_WIDTH;
screenshot_disp_drv.ver_res = TFT_HEIGHT;
screenshot_disp_drv.flush_cb = screenshot_disp_flush;
screenshot_disp_drv.buffer = &screenshot_disp_buf;
screenshot_disp = lv_disp_drv_register( &screenshot_disp_drv );
lv_disp_set_default( system_disp );
png = (uint16_t*)ps_malloc( LV_HOR_RES_MAX * LV_VER_RES_MAX * sizeof( lv_color_t ) );
}
void screenshot_take( void ) {
Serial.printf("take screenshot\r\n");
lv_disp_drv_t driver;
lv_disp_t *system_disp;;
screenshot_disp->driver.flush_cb = system_disp->driver.flush_cb;
system_disp = lv_disp_get_default();
driver.flush_cb = system_disp->driver.flush_cb;
system_disp->driver.flush_cb = screenshot_disp_flush;
lv_obj_invalidate( lv_scr_act() );
lv_refr_now( system_disp );
system_disp->driver.flush_cb = screenshot_disp->driver.flush_cb;
system_disp->driver.flush_cb = driver.flush_cb;
}
void screenshot_save( void ) {
Serial.printf("save screenshot\r\n");
SPIFFS.remove("/screen.565");
fs::File file = SPIFFS.open( "/screen.565", FILE_WRITE );
file.write( (uint8_t *)png, LV_HOR_RES_MAX * LV_VER_RES_MAX * 2 );
file.close();
fs::File root = SPIFFS.open("/");
file = root.openNextFile();
while(file){
Serial.printf("FILE: %s (%dbytes)\r\n", file.name(), file.size() );
file = root.openNextFile();
}
}
static void screenshot_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p ) {

View File

@@ -62,7 +62,7 @@ void asyncwebserver_setup(void){
});
asyncserver.on("/shot", HTTP_GET, [](AsyncWebServerRequest * request) {
request->send(200, "text/plain", "Firmwarestand: " __DATE__ " " __TIME__ "\r\nGCC-Version: " __VERSION__ "\r\n" );
request->send(200, "text/plain", "screen is taken\r\n" );
screenshot_take();
screenshot_save();
});