@@ -146,32 +146,33 @@ static int _set_vid(void) {
146146 vid_setting = value ;
147147 /*
148148 Voltage Divider with 3.3V: (1241 * V)
149- 10K/ 15K = 1.98V = 2458
150- 15K/ 10K = 1.32V = 1638
151- 15K/4.7K = 0.79V = 980
152- 15K/ 2K = 1.32V = 482
153- 15K/ 1K = 1.32V = 256
149+ 10K/ 15K = 1.98V = 2458 GT 2000 = TBD
150+ 15K/ 10K = 1.32V = 1638 GT 1200 = Explorer with SSD1681 BW
151+ 15K/4.7K = 0.79V = 980 GT 600 = Explorer with SSD1681 BWR
152+ 15K/ 2K = 0.39V = 482 GT 300 = Explorer with SSD1608 BW
153+ 100K/ 10K = 0.30V = 372 ditto
154+ 15K/ 1K = 0.21V = 256 GT 150 = DCNextGen with SSD1681 BWR
154155 Note: extreme values (using 100K or greater) will not create a strong enough current for the ADC to read accurately
155156 Note: we do not get a usable value when the voltage divider is missing
156157 */
157158
158159 // TODO change to min/max to tighten up the ranges (requires sampling of the initial boards)
159160 if (value > 2800 ) {
160- vid_setting = 9 ;
161+ vid_setting = 9 ; // invalid
161162 } else if (value > 2000 ) {
162- vid_setting = 5 ;
163+ vid_setting = 5 ; // future
163164 } else if (value > 1200 ) {
164- vid_setting = 4 ;
165+ vid_setting = 4 ; // Explorer SSD1681 BW
165166 } else if (value > 600 ) {
166- vid_setting = 3 ;
167+ vid_setting = 3 ; // Explorer SSD1681 BWR
167168 } else if (value > 300 ) {
168- vid_setting = 2 ;
169+ vid_setting = 2 ; // Explorer SSD1608 BW
169170 } else if (value > 150 ) {
170- vid_setting = 1 ;
171+ vid_setting = 1 ; // DCNextGen SSD1681 BWR
171172 } else {
172- vid_setting = 0 ;
173- }
173+ vid_setting = 0 ; // invalid
174174
175+ }
175176 return vid_setting ;
176177}
177178
@@ -227,8 +228,29 @@ void board_init(void) {
227228 display = & allocate_display ()-> epaper_display ;
228229 display -> base .type = & epaperdisplay_epaperdisplay_type ;
229230
230- // VID codes: 1 = tricolor ePaper (BWR), 2 = monochrome ePaper (BW), other codes are TBD
231+ // default to no rotation
232+ int rotation = 0 ;
231233 if (vid_setting == 1 ) {
234+ // DCNextGen SSD1681 BWR rotated 270
235+ rotation = 270 ;
236+ }
237+
238+ // default to BWR refresh rates
239+ float refresh_time = 15.0 ;
240+ float seconds_per_frame = 20.0 ;
241+ if ((vid_setting == 2 ) || (vid_setting == 4 )) {
242+ // BW displays have faster refresh rates
243+ refresh_time = 1.0 ;
244+ seconds_per_frame = 5.0 ;
245+ }
246+
247+ // VID 1, 3, and 4 = SSD1681 display driver
248+ // VID 2 = SSD1608 display driver
249+
250+ // VID codes: see above
251+ if ((vid_setting == 1 ) || // DCNextGen SSD1681 BWR rotated 270
252+ (vid_setting == 3 ) || // Explorer SSD1681 BW rotated 0
253+ (vid_setting == 4 )) { // Explorer SSD1681 BWR rotated 0
232254 common_hal_epaperdisplay_epaperdisplay_construct (
233255 display ,
234256 bus ,
@@ -241,7 +263,7 @@ void board_init(void) {
241263 HEIGHT + 0x60 , // ram_height RAM is actually only 200 bits high but we use 296 to match the 9 bits
242264 0 , // colstart
243265 0 , // rowstart
244- 270 , // rotation
266+ rotation , // rotation
245267 SSD_SET_RAMXPOS , // set_column_window_command
246268 SSD_SET_RAMYPOS , // set_row_window_command
247269 SSD_SET_RAMXCOUNT , // set_current_column_command
@@ -252,16 +274,16 @@ void board_init(void) {
252274 false, // color_bits_inverted
253275 0xFF0000 , // highlight_color (RED for tri-color display)
254276 _refresh_sequence_ssd1681 , sizeof (_refresh_sequence_ssd1681 ), // refresh_display_command
255- 15.0 , // refresh_time
277+ refresh_time , // refresh_time
256278 & pin_GPIO9 , // DEFAULT_SPI_BUS_BUSY, // busy_pin
257279 true, // busy_state
258- 20.0 , // seconds_per_frame (does not seem the user can change this)
280+ seconds_per_frame , // seconds_per_frame (does not seem the user can change this)
259281 true, // always_toggle_chip_select
260282 false, // not grayscale
261283 false, // not acep
262284 false, // not two_byte_sequence_length
263285 true); // address_little_endian
264- } else if (vid_setting == 2 ) {
286+ } else if (vid_setting == 2 ) { // Explorer SSD1608 BW
265287 common_hal_epaperdisplay_epaperdisplay_construct (
266288 display ,
267289 bus ,
@@ -274,7 +296,7 @@ void board_init(void) {
274296 HEIGHT /* + 0x60 */ , // ram_height RAM is actually only 200 bits high but we use 296 to match the 9 bits
275297 0 , // colstart
276298 0 , // rowstart
277- 0 , // rotation
299+ rotation , // rotation
278300 SSD_SET_RAMXPOS , // set_column_window_command
279301 SSD_SET_RAMYPOS , // set_row_window_command
280302 SSD_SET_RAMXCOUNT , // set_current_column_command
@@ -285,10 +307,10 @@ void board_init(void) {
285307 false, // color_bits_inverted
286308 0x000000 , // highlight_color (RED for tri-color display)
287309 _refresh_sequence_ssd1608 , sizeof (_refresh_sequence_ssd1608 ), // refresh_display_command
288- 1.0 , // refresh_time
310+ refresh_time , // refresh_time
289311 & pin_GPIO9 , // DEFAULT_SPI_BUS_BUSY, // busy_pin
290312 true, // busy_state
291- 5.0 , // seconds_per_frame (does not seem the user can change this)
313+ seconds_per_frame , // seconds_per_frame (does not seem the user can change this)
292314 true, // always_toggle_chip_select
293315 false, // not grayscale
294316 false, // not acep
0 commit comments