@@ -76,6 +76,108 @@ class Protocol {
7676 await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, 0x92 ]));
7777 }
7878
79+
80+ static const int GND = 0 ;
81+ static const int VSH = 0x40 ;
82+ static const int VSL = 0x80 ;
83+ static const int VDHR = 0x60 ;
84+
85+ static const int VCOM_LUT = 0x20 ;
86+ static const int W2W_LUT = 0x21 ;
87+ static const int B2W_LUT = 0x22 ;
88+ static const int W2B_LUT = 0x23 ;
89+ static const int B2B_LUT = 0x24 ;
90+
91+ static const int PANEL_SETTING = 0x00 ;
92+ static const int PLL_CONTROL = 0x30 ;
93+
94+ Uint8List lut_vcom_quick = Uint8List .fromList ([
95+ 0x01 , 0x00 , 10 , 0x00 , 0x00 , 0x01 , 0x00 ,
96+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
97+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
98+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
99+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
100+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
101+
102+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
103+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
104+ ]);
105+
106+ // white gates go white with VSL
107+ Uint8List lut_ww_quick = Uint8List .fromList ([
108+ 0x01 , VSL | 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
109+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
110+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
111+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
112+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
113+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
114+ ]);
115+
116+ // red gates go white with VSL, go red with VSH
117+ Uint8List lut_r_quick = Uint8List .fromList ([
118+ 0x01 , VSL | 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
119+ 0x01 , 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
120+ 0x01 , VSH | 10 , 5 , 0x00 , 0x00 , 0x02 , 0x00 ,
121+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
122+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
123+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
124+
125+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
126+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
127+ ]);
128+
129+ // V*H will make white gates as black/red
130+ Uint8List lut_w_quick = Uint8List .fromList ([
131+ 0x01 , 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
132+ 0x01 , 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
133+ 0x01 , 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
134+ 0x00 , VSH | 2 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
135+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
136+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
137+
138+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
139+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
140+ ]);
141+
142+ // black gates go black/red with VSH
143+ Uint8List lut_b_quick = Uint8List .fromList ([
144+ 0x01 , 10 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
145+ 0x01 , VSH | 12 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 ,
146+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
147+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
148+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
149+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
150+
151+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
152+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
153+ ]);
154+
155+ Future <void > _setlut (Uint8List tagId) async {
156+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, PLL_CONTROL ]));
157+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, 0x01 ])); // 10hz
158+
159+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, VCOM_LUT ]));
160+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, ...lut_vcom_quick]));
161+
162+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, W2W_LUT ]));
163+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, ...lut_ww_quick]));
164+
165+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, B2W_LUT ]));
166+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, ...lut_r_quick]));
167+
168+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, W2B_LUT ]));
169+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, ...lut_w_quick]));
170+
171+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, B2B_LUT ]));
172+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, ...lut_b_quick]));
173+ }
174+
175+ Future <void > _panelSetting (Uint8List tagId) async {
176+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdCmd, PANEL_SETTING ]));
177+ // await _writeMsg(tagId, Uint8List.fromList([fw.epdSend, 0xCF, 0x8D])); // 480x240, built-in LUTs
178+ await _writeMsg (tagId, Uint8List .fromList ([fw.epdSend, 0xEF , 0x8D ])); // 480x240, LUTs from register
179+ }
180+
79181 Future <void > _sleep () async {
80182 await Future .delayed (const Duration (milliseconds: 20 ));
81183 }
@@ -158,7 +260,9 @@ class Protocol {
158260 await Future .delayed (
159261 const Duration (seconds: 2 )); // waiting for the power supply stable
160262
161- await _setPartialWindow (id, 0 , epd.width ~ / 8 - 1 , 0 , epd.height - 1 , true );
263+ // await _setPartialWindow(id, 0, epd.width ~/ 8 - 1, 0, epd.height - 1, true);
264+ await _panelSetting (id);
265+ await _setlut (id);
162266
163267 final epdColors = epd.extractEpaperColorFrames (image);
164268 final transmissionLines = epd.controller.transmissionLines.iterator;
@@ -167,8 +271,8 @@ class Protocol {
167271 await writeFrame (id, c, transmissionLines.current);
168272 }
169273
170- await _setPartialWindow (id, 0 , 15 , 0 , 200 , true );
171- _partialIn (id);
274+ // await _setPartialWindow(id, 0, 15, 0, 200, true);
275+ // _partialIn(id);
172276 await _writeMsg (
173277 id, Uint8List .fromList ([fw.epdCmd, epd.controller.refresh]));
174278 await FlutterNfcKit .finish ();
0 commit comments