Skip to content

Commit

Permalink
prerelease 1.9R1
Browse files Browse the repository at this point in the history
CSV:
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,"standard_touch.csv. "
L_COMMENT,data,string,This is the standard configuration with the touch
screen added.

gpio_space,namespace,,
....
__________________________
sys.conf
##CONFIG#
#LABEL: standard_touch.csv.
#COMMENT: This is the standard configuration with the touch screen
added.

And new: Double click for time/main as before , but choice is now
permanent.
Bugs removed.
More reactive display.
  • Loading branch information
karawin committed Feb 19, 2019
1 parent 26c0a9f commit 294a1ad
Show file tree
Hide file tree
Showing 35 changed files with 328 additions and 209 deletions.
Binary file modified boards/build/lolin32pro.bin
Binary file not shown.
Binary file modified boards/build/new_psram.bin
Binary file not shown.
Binary file modified boards/build/odroid-go.bin
Binary file not shown.
Binary file modified boards/build/pattern.bin
Binary file not shown.
Binary file modified boards/build/standard_adb.bin
Binary file not shown.
Binary file modified boards/build/standard_psram.bin
Binary file not shown.
Binary file modified boards/build/standard_touch.bin
Binary file not shown.
Binary file removed boards/build/test.bin
Binary file not shown.
Binary file modified boards/build/ttgot8.bin
Binary file not shown.
Binary file modified boards/build/ttgotm.bin
Binary file not shown.
5 changes: 5 additions & 0 deletions boards/lolin32pro.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,lolin32pro.csv
L_COMMENT,data,string,This is the configuration for a lolin pro with wrover cpu.

gpio_space,namespace,,
K_SPI,data,u8,1
P_MISO,data,u8,12
Expand Down
7 changes: 6 additions & 1 deletion boards/new_psram.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,new_psram.csv
L_COMMENT,data,string,This is the standard simple configuration for a wrover .

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down Expand Up @@ -46,7 +51,7 @@ O_DDMM_FLAG,data,u8,255
custom_ir_space,namespace,,
K_UP,data,string,
K_LEFT,data,string,
K_OK,data,string,0
K_OK,data,string,
K_RIGHT,data,string,
K_DOWN,data,string,
K_0,data,string,
Expand Down
5 changes: 5 additions & 0 deletions boards/odroid-go.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,odroid-go.csv
L_COMMENT,data,string,This is the standard configuration for an odroid-go board.

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
16 changes: 16 additions & 0 deletions boards/pattern.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,pattern.csv
L_COMMENT,data,string,pattern for all csv files

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down Expand Up @@ -32,6 +37,17 @@ P_I2S_BCLK,data,u8,26
P_I2S_DATA,data,u8,22
P_ADC,data,u8,255
P_BACKLIGHT,data,u8,255
P_TOUCH_CS,data,u8,16
P_JOY_0,data,u8,255
P_JOY_1,data,u8,255
P_LED_GPIO,data,u8,4

option_space,namespace,,
O_LCD_TYPE,data,u8,255
O_LCD_ROTA,data,u8,0
O_LCD_OUT,data,u32,0
O_DDMM_FLAG,data,u8,1

custom_ir_space,namespace,,
K_UP,data,string,
K_LEFT,data,string,
Expand Down
11 changes: 8 additions & 3 deletions boards/standard_adb.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,standard_adb.csv
L_COMMENT,data,string,This is the standard default configuration as in the builtin conf.

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down Expand Up @@ -39,9 +44,9 @@ P_BACKLIGHT,data,u8,255

option_space,namespace,,
O_LCD_TYPE,data,u8,255
O_LCD_ROTA,data,u8,255
O_LCD_OUT,data,u32,255
O_DDMM_FLAG,data,u8,255
O_LCD_ROTA,data,u8,0
O_LCD_OUT,data,u32,0
O_DDMM_FLAG,data,u8,0

custom_ir_space,namespace,,
K_UP,data,string,
Expand Down
5 changes: 5 additions & 0 deletions boards/standard_psram.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,standard_psram.csv
L_COMMENT,data,string,This is the standard configuration for a wrover.

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
5 changes: 5 additions & 0 deletions boards/standard_touch.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,"standard_touch.csv. "
L_COMMENT,data,string,This is the standard configuration with the touch screen added.

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
61 changes: 0 additions & 61 deletions boards/test.csv

This file was deleted.

5 changes: 5 additions & 0 deletions boards/ttgot8.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,ttgot8.csv
L_COMMENT,data,string,LilyGo/TTGO-T8 board .

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
5 changes: 5 additions & 0 deletions boards/ttgotm.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,ttgotm.csv
L_COMMENT,data,string,LilyGO/TTGO-TM-ESP32 board .

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
5 changes: 5 additions & 0 deletions boards/ttgov4.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
key,type,encoding,value

label_space,namespace,,
L_LABEL,data,string,4csv
L_COMMENT,data,string,LilyGO/TTGO-T4 board .

gpio_space,namespace,,
K_SPI,data,u8,2
P_MISO,data,u8,19
Expand Down
12 changes: 6 additions & 6 deletions main/ClickButtons.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Button_t* ClickButtonsInit(int8_t A, int8_t B, int8_t C)
enc->button[i] = Open;
enc->keyDownTicks[i] = 0;
enc->doubleClickTicks[i] = 0;
enc->lastButtonCheck[i] = 0;
// enc->lastButtonCheck[i] = 0;
}
enc->doubleClickEnabled = true; enc->buttonHeldEnabled = true;

Expand Down Expand Up @@ -76,15 +76,15 @@ IRAM_ATTR void serviceBtn(Button_t *enc)
{
// handle enc->button
//
unsigned long currentMillis = xTaskGetTickCount()* portTICK_PERIOD_MS;
// unsigned long currentMillis = xTaskGetTickCount()* portTICK_PERIOD_MS;

for(uint8_t i = 0; i < 3; i++)
{
if (currentMillis < enc->lastButtonCheck[i]) enc->lastButtonCheck[i] = 0; // Handle case when millis() wraps back around to zero
if ((enc->pinBTN[i] > 0 ) // check enc->button only, if a pin has been provided
&& ((currentMillis - enc->lastButtonCheck[i]) >= ENC_BUTTONINTERVAL)) // checking enc->button is sufficient every 10-30ms
// if (currentMillis < enc->lastButtonCheck[i]) enc->lastButtonCheck[i] = 0; // Handle case when millis() wraps back around to zero
if ((enc->pinBTN[i] > 0 )) // check enc->button only, if a pin has been provided
// && ((currentMillis - enc->lastButtonCheck[i]) >= ENC_BUTTONINTERVAL)) // checking enc->button is sufficient every 10-30ms
{
enc->lastButtonCheck[i] = currentMillis;
// enc->lastButtonCheck[i] = currentMillis;

bool pinRead = getPinStates(enc,i);

Expand Down
68 changes: 50 additions & 18 deletions main/ClickEncoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,40 +129,61 @@ bool getHalfStep(Encoder_t *enc)
//void (*serviceEncoder)() = NULL;
IRAM_ATTR void service(Encoder_t *enc)
{
bool moved = false;
volatile bool moved = false;

if (enc->pinA >= 0 && enc->pinB >= 0) {
if (enc->accelerationEnabled) { // decelerate every tick
enc->acceleration -= ENC_ACCEL_DEC;
if (enc->acceleration & 0x8000) { // handle overflow of MSB is set
enc->acceleration = 0;
}
}
// if (enc->pinA >= 0 && enc->pinB >= 0)
{
// if (enc->accelerationEnabled)
{ // decelerate every tick
enc->acceleration -= ENC_ACCEL_DEC;
if (enc->acceleration & 0x8000)
{ // handle overflow of MSB is set
enc->acceleration = 0;
//enc->dcount++;
}
}

int8_t curr = 0;
if (digitalRead(enc->pinA) == enc->pinsActive) {
volatile int8_t curr = 0;
volatile int va,vb;
va = digitalRead(enc->pinA);
vb = digitalRead(enc->pinB);

// if (digitalRead(enc->pinA) == enc->pinsActive) {
// if (digitalRead(enc->pinA) == 0) {
if (va == 0) {
curr = 3;
}

if (digitalRead(enc->pinB) == enc->pinsActive) {
// if (digitalRead(enc->pinB) == enc->pinsActive) {
// if (digitalRead(enc->pinB) == 0) {
if (vb == 0) {
curr ^= 1;
}

int8_t diff = enc->last - curr;
volatile int8_t diff = enc->last - curr;

if (diff & 1) { // bit 0 = step
//printf("diff: %d cur: %d last: %d delta: %d\n",diff,curr,enc->last,enc->delta);
/*
enc->pcurr = curr;
enc->plast = enc->last;
enc->pdiff = diff;
enc->count++;
*/
enc->last = curr;
enc->delta += (diff & 2) - 1; // bit 1 = direction (+/-)
moved = true;
//enc->pdelta = enc->delta;
}

if (enc->accelerationEnabled && moved) {
if (/*enc->accelerationEnabled &&*/ moved) {
// increment accelerator if encoder has been moved
if (enc->acceleration <= (ENC_ACCEL_TOP - enc->accel_inc)) {
enc->acceleration += enc->accel_inc ;
}
if (enc->acceleration <= (ENC_ACCEL_TOP - enc->accel_inc)) {
enc->acceleration += enc->accel_inc ;
//enc->icount++;
}
}
}
}
// handle enc->button
//
unsigned long currentMillis = xTaskGetTickCount()* portTICK_PERIOD_MS;
Expand Down Expand Up @@ -239,7 +260,18 @@ int16_t getValue(Encoder_t *enc)
else if (val > 0) {
r += 1 + accel;
}
// if (r != 0) printf("Acceleration: %d accel: %d val:%d,, R:%d\n",enc->acceleration,accel,val,r);

/*
if (r != 0)
{
printf("count: %d pdiff: %d pcur: %d plast: %d pdelta: %d\n",enc->count,enc->pdiff,enc->pcurr,enc->plast,enc->pdelta);
printf(" increment: %d decrement: %d\n",enc->icount,enc->dcount);
enc->count = 0;
enc->icount= 0;
enc->dcount=0;
printf("Acceleration: %d step: %d last: %d val:%d,, R:%d\n",enc->acceleration,enc->steps,enc->last,val,r);
}
*/
interrupts();

return r;
Expand Down
27 changes: 12 additions & 15 deletions main/ClickJoystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Joystick_t* ClickJoystickInit(int8_t A)
enc->button[i] = Open;
enc->keyDownTicks[i] = 0;
enc->doubleClickTicks[i] = 0;
enc->lastButtonCheck[i] = 0;
// enc->lastButtonCheck[i] = 0;
}
enc->doubleClickEnabled = true; enc->buttonHeldEnabled = true;

Expand All @@ -61,18 +61,16 @@ IRAM_ATTR void serviceJoystick(Joystick_t *enc)
{
// handle enc->button
//
unsigned long currentMillis = xTaskGetTickCount()* portTICK_PERIOD_MS;
// unsigned long currentMillis = xTaskGetTickCount()* portTICK_PERIOD_MS;
bool pinRead[NBBUTTONS];
getJoyStates(enc, pinRead);
for(uint8_t i = 0; i < NBBUTTONS; i++)
{
if (currentMillis < enc->lastButtonCheck[i]) enc->lastButtonCheck[i] = 0; // Handle case when millis() wraps back around to zero
if (((currentMillis - enc->lastButtonCheck[i]) >= ENC_BUTTONINTERVAL)) // checking enc->button is sufficient every 10-30ms
// if (currentMillis < enc->lastButtonCheck[i]) enc->lastButtonCheck[i] = 0; // Handle case when millis() wraps back around to zero
// if (((currentMillis - enc->lastButtonCheck[i]) >= ENC_BUTTONINTERVAL)) // checking enc->button is sufficient every 10-30ms
{
enc->lastButtonCheck[i] = currentMillis;



// enc->lastButtonCheck[i] = currentMillis;

if (pinRead[i] == true) { // key is down
enc->keyDownTicks[i]++;
if ((enc->keyDownTicks[i] > (BTN_HOLDTIME / ENC_BUTTONINTERVAL)) && (enc->buttonHeldEnabled))
Expand All @@ -98,17 +96,16 @@ IRAM_ATTR void serviceJoystick(Joystick_t *enc)
else {
enc->doubleClickTicks[i] = (enc->doubleClickEnabled) ? (BTN_DOUBLECLICKTIME / ENC_BUTTONINTERVAL) : ENC_SINGLECLICKONLY;
}
}
}
}

enc->keyDownTicks[i] = 0;
enc->keyDownTicks[i] = 0;
}

if (enc->doubleClickTicks[i] > 0) {
enc->doubleClickTicks[i]--;
if (enc->doubleClickTicks[i] == 0) {
enc->button[i] = Clicked;
}
enc->doubleClickTicks[i]--;
if (enc->doubleClickTicks[i] == 0) {
enc->button[i] = Clicked;
}
}
}
}
Expand Down
Loading

0 comments on commit 294a1ad

Please sign in to comment.