Some small optimizations, print mem use

This commit is contained in:
Jeroen Domburg 2017-05-30 13:39:07 +08:00
parent 3f7593a6e7
commit 42e97a4658
3 changed files with 9 additions and 2 deletions

View File

@ -208,7 +208,7 @@ void mipiInit() {
spidev->ctrl.rd_bit_order=1; //LSB first spidev->ctrl.rd_bit_order=1; //LSB first
spidev->ctrl.wr_bit_order=1; spidev->ctrl.wr_bit_order=1;
spidev->pin.ck_idle_edge=0; spidev->pin.ck_idle_edge=0;
spidev->user.ck_out_edge=1; spidev->user.ck_out_edge=1; //0 for <40MHz?
spidev->ctrl2.miso_delay_mode=0; spidev->ctrl2.miso_delay_mode=0;
spidev->ctrl.val &= ~(SPI_FREAD_DUAL|SPI_FREAD_QUAD|SPI_FREAD_DIO|SPI_FREAD_QIO); spidev->ctrl.val &= ~(SPI_FREAD_DUAL|SPI_FREAD_QUAD|SPI_FREAD_DIO|SPI_FREAD_QIO);
spidev->user.val &= ~(SPI_FWRITE_DUAL|SPI_FWRITE_QUAD|SPI_FWRITE_DIO|SPI_FWRITE_QIO); spidev->user.val &= ~(SPI_FWRITE_DUAL|SPI_FWRITE_QUAD|SPI_FWRITE_DIO|SPI_FWRITE_QIO);

View File

@ -145,7 +145,7 @@ int findPixelVal(uint8_t *data, int x, int y) {
volatile static uint8_t *currFbPtr=NULL; volatile static uint8_t *currFbPtr=NULL;
SemaphoreHandle_t dispSem = NULL; SemaphoreHandle_t dispSem = NULL;
#define LINESPERBUF 8 #define LINESPERBUF 32
static void initLcd() { static void initLcd() {
mipiInit(); mipiInit();
@ -173,6 +173,7 @@ void IRAM_ATTR displayTask(void *arg) {
assert(img); assert(img);
calcLut(); calcLut();
int firstrun=1;
while(1) { while(1) {
int l=0; int l=0;
mipiResync(); mipiResync();
@ -192,6 +193,8 @@ void IRAM_ATTR displayTask(void *arg) {
img[0]=0x3c; img[0]=0x3c;
l=0; l=0;
p=&img[1]; p=&img[1];
if (!firstrun && j>=200) break; //no need to render black bar in subsequent times
firstrun=0;
} }
} }
} }
@ -205,6 +208,7 @@ void dispDraw(uint8_t *mem) {
xSemaphoreGive(dispSem); xSemaphoreGive(dispSem);
adns900_get_dxdybtn(&dx, &dy, &btn); adns900_get_dxdybtn(&dx, &dy, &btn);
mouseMove(dx, dy, btn); mouseMove(dx, dy, btn);
// printf("Mouse: %d %d\n", dx, dy);
} }

View File

@ -16,6 +16,8 @@
#include "ncr.h" #include "ncr.h"
#include "hd.h" #include "hd.h"
#include "mouse.h" #include "mouse.h"
#include <stdbool.h>
#include "esp_heap_alloc_caps.h"
unsigned char *macRom; unsigned char *macRom;
unsigned char *macRam; unsigned char *macRam;
@ -105,6 +107,7 @@ void printFps() {
long msec=(tv.tv_sec-oldtv.tv_sec)*1000; long msec=(tv.tv_sec-oldtv.tv_sec)*1000;
msec+=(tv.tv_usec-oldtv.tv_usec)/1000; msec+=(tv.tv_usec-oldtv.tv_usec)/1000;
printf("Speed: %d%%\n", (int)(100000/msec)); printf("Speed: %d%%\n", (int)(100000/msec));
printf("Mem free: %dKiB 8-bit, %dKiB 32-bit\n", xPortGetFreeHeapSizeCaps(MALLOC_CAP_8BIT)/1024, xPortGetFreeHeapSizeCaps(MALLOC_CAP_32BIT)/1024);
} }
oldtv.tv_sec=tv.tv_sec; oldtv.tv_sec=tv.tv_sec;
oldtv.tv_usec=tv.tv_usec; oldtv.tv_usec=tv.tv_usec;