Skip to content

Commit c9492d9

Browse files
committed
One more power up and power down TPS code fix.
1 parent 64fa39c commit c9492d9

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/Inkplate.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,40 +104,37 @@ int Inkplate::einkOn()
104104
WAKEUP_SET;
105105
delay(5);
106106

107-
// Modify power up sequence.
108-
Wire.beginTransmission(0x48);
109-
Wire.write(0x09);
110-
Wire.write(B11100100);
111-
Wire.endTransmission();
112-
113-
// Modify power down sequence (VEE and VNEG are swapped)
114-
Wire.beginTransmission(0x48);
115-
Wire.write(0x0b);
116-
Wire.write(B00011011);
117-
Wire.endTransmission();
118-
119107
#ifdef ARDUINO_INKPLATE6PLUSV2
120108
if (pwrMode != INKPLATE_USB_PWR_ONLY)
121109
{
122110
// Enable all rails
123111
Wire.beginTransmission(0x48);
124112
Wire.write(0x01);
125-
Wire.write(B00111111);
113+
Wire.write(B00100000);
126114
Wire.endTransmission();
127115
}
128116
#else
129117
// Enable all rails
130118
Wire.beginTransmission(0x48);
131119
Wire.write(0x01);
132-
Wire.write(B00111111);
120+
Wire.write(B00100000);
133121
Wire.endTransmission();
134122
#endif
135123

136-
PWRUP_SET;
124+
// Modify power up sequence.
125+
Wire.beginTransmission(0x48);
126+
Wire.write(0x09);
127+
Wire.write(B11100100);
128+
Wire.endTransmission();
129+
130+
// Modify power down sequence (VEE and VNEG are swapped)
131+
Wire.beginTransmission(0x48);
132+
Wire.write(0x0b);
133+
Wire.write(B00011011);
134+
Wire.endTransmission();
137135

138136
pinsAsOutputs();
139137
LE_CLEAR;
140-
OE_CLEAR;
141138
#if !defined(ARDUINO_ESP32_DEV) && !defined(ARDUINO_INKPLATE6V2) && !defined(ARDUINO_INKPLATE6FLICK)
142139
CL_CLEAR;
143140
#endif
@@ -146,7 +143,8 @@ int Inkplate::einkOn()
146143
SPV_SET;
147144
CKV_CLEAR;
148145
OE_CLEAR;
149-
VCOM_SET;
146+
PWRUP_SET;
147+
setPanelState(1);
150148

151149
unsigned long timer = millis();
152150
do
@@ -155,13 +153,12 @@ int Inkplate::einkOn()
155153
} while ((readPowerGood() != PWR_GOOD_OK) && (millis() - timer) < 250);
156154
if ((millis() - timer) >= 250)
157155
{
158-
VCOM_CLEAR;
159-
PWRUP_CLEAR;
156+
einkOff();
160157
return 0;
161158
}
162159

160+
VCOM_SET;
163161
OE_SET;
164-
setPanelState(1);
165162

166163
return 1;
167164
}
@@ -174,6 +171,7 @@ void Inkplate::einkOff()
174171
{
175172
if (getPanelState() == 0)
176173
return;
174+
VCOM_CLEAR;
177175
OE_CLEAR;
178176
GMOD_CLEAR;
179177
#if !defined(ARDUINO_ESP32_DEV) && !defined(ARDUINO_INKPLATE6V2) && !defined(ARDUINO_INKPLATE6FLICK)
@@ -184,8 +182,6 @@ void Inkplate::einkOff()
184182
CKV_CLEAR;
185183
SPH_CLEAR;
186184
SPV_CLEAR;
187-
188-
VCOM_CLEAR;
189185
PWRUP_CLEAR;
190186

191187
unsigned long timer = millis();
@@ -200,7 +196,11 @@ void Inkplate::einkOff()
200196
if (pwrMode != INKPLATE_USB_PWR_ONLY)
201197
WAKEUP_CLEAR;
202198
#else
203-
WAKEUP_CLEAR;
199+
WAKEUP_CLEAR; // Disable 3V3 Switch for ePaper.
200+
Wire.beginTransmission(0x48);
201+
Wire.write(0x01);
202+
Wire.write(B00000000);
203+
Wire.endTransmission();
204204
#endif
205205
#endif
206206

0 commit comments

Comments
 (0)