@@ -1122,6 +1122,8 @@ int bbepIOInit(FASTEPDSTATE *pState)
1122
1122
#endif
1123
1123
int rc = (*(pState->pfnIOInit ))(pState);
1124
1124
if (rc != BBEP_SUCCESS) return rc;
1125
+ pState->iPartialPasses = 4 ; // N.B. The default number of passes for partial updates
1126
+ pState->iFullPasses = 5 ; // the default number of passes for smooth and full updates
1125
1127
// Initialize the ESP32 LCD API to drive parallel data at high speed
1126
1128
// The code forces the use of a D/C pin, so we must assign it to an unused GPIO on each device
1127
1129
s3_bus_config.dc_gpio_num = (gpio_num_t )pState->panelDef .ioDCDummy ;
@@ -1245,6 +1247,32 @@ int bbepSetPanelSize(FASTEPDSTATE *pState, int width, int height, int flags) {
1245
1247
return BBEP_SUCCESS;
1246
1248
} /* setPanelSize() */
1247
1249
1250
+ //
1251
+ // Set the individual brightness of the 1 or 2 front lights
1252
+ //
1253
+ void bbepSetBrightness (FASTEPDSTATE *pState, uint8_t led1, uint8_t led2)
1254
+ {
1255
+ ledcWrite (pState->u8LED1 , led1); // PWM (0-255)
1256
+ if (pState->u8LED2 != 0xff ) {
1257
+ ledcWrite (pState->u8LED2 , led2);
1258
+ }
1259
+ } /* bbepSetBrightness() */
1260
+
1261
+ //
1262
+ // Initialize the front light(s) if present
1263
+ //
1264
+ void bbepInitLights (FASTEPDSTATE *pState, uint8_t led1, uint8_t led2)
1265
+ {
1266
+ pState->u8LED1 = led1;
1267
+ pState->u8LED2 = led2;
1268
+ ledcAttach (led1, 5000 , 8 ); // attach pin to channel 0
1269
+ ledcWrite (led1, 0 ); // set to off to start
1270
+ if (led2 != 0xff ) {
1271
+ ledcAttach (led2, 5000 , 8 );
1272
+ ledcWrite (led2, 0 ); // set to off
1273
+ }
1274
+ } /* bbepInitLights() */
1275
+
1248
1276
//
1249
1277
// Initialize the panel based on the constant name
1250
1278
// Each name points to a configuration with info about the PCB and possibly a display
@@ -1468,8 +1496,8 @@ int bbepSmoothUpdate(FASTEPDSTATE *pState, bool bKeepOn, uint8_t u8Color)
1468
1496
}
1469
1497
}
1470
1498
} // for i
1471
- // Write 5 passes of the black data to the whole display
1472
- for (pass = 0 ; pass < 5 ; pass++) {
1499
+ // Write N passes of the black data to the whole display
1500
+ for (pass = 0 ; pass < pState-> iFullPasses ; pass++) {
1473
1501
bbepRowControl (pState, ROW_START);
1474
1502
for (i = 0 ; i < pState->native_height ; i++) {
1475
1503
s = &pState->pTemp [i * (pState->native_width / 4 )];
@@ -1607,8 +1635,8 @@ int bbepFullUpdate(FASTEPDSTATE *pState, bool bFast, bool bKeepOn, BBEPRECT *pRe
1607
1635
}
1608
1636
// vTaskDelay(0);
1609
1637
} // for i
1610
- // Write 5 passes of the black data to the whole display
1611
- for (pass = 0 ; pass < 5 ; pass++) {
1638
+ // Write N passes of the black data to the whole display
1639
+ for (pass = 0 ; pass < pState-> iFullPasses ; pass++) {
1612
1640
bbepRowControl (pState, ROW_START);
1613
1641
for (i = 0 ; i < pState->native_height ; i++) {
1614
1642
s = &pState->pTemp [i * (pState->native_width / 4 )];
@@ -1741,7 +1769,7 @@ int bbepPartialUpdate(FASTEPDSTATE *pState, bool bKeepOn, int iStartLine, int iE
1741
1769
iStartLine = iEndLine;
1742
1770
iEndLine = i;
1743
1771
}
1744
- for (pass = 0 ; pass < 4 ; pass++) { // each pass is about 32ms
1772
+ for (pass = 0 ; pass < pState-> iPartialPasses ; pass++) { // each pass is about 32ms
1745
1773
uint8_t *dp = pState->pTemp ;
1746
1774
int iDelta = pState->native_width / 4 ; // 2 bits per pixel
1747
1775
int iSkipped = 0 ;
0 commit comments