Skip to content

Commit 8df1b88

Browse files
Enable an ESP32 version update (#25)
Enable an update to esp32 version 3.1.0: Dark theme for the Websites Remove not needed sleep parameters Remove Gotham font Because of the small ULP memory only stores temperature/humidity every 2 minutes Re enable USB mass storage updates
1 parent 25bb626 commit 8df1b88

File tree

4 files changed

+52
-119
lines changed

4 files changed

+52
-119
lines changed

.github/workflows/arduino_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
platforms: |
1717
- name: esp32:esp32
1818
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
19-
version: 2.0.13
19+
version: 3.1.0
2020
libraries: |
2121
- name: Adafruit DotStar
2222
- name: Sensirion Core

OpenCO2_Sensor.ino

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- WiFiManager: https://github.com/tzapu/WiFiManager
1111
- ArduinoMqttClient (if MQTT is defined)
1212
*/
13-
#define VERSION "v5.4"
13+
#define VERSION "v5.5"
1414

1515
#define HEIGHT_ABOVE_SEA_LEVEL 50 // Berlin
1616
#define TZ_DATA "CET-1CEST,M3.5.0,M10.5.0/3" // Europe/Berlin time zone from https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
@@ -42,7 +42,6 @@ WiFiManager wifiManager;
4242
#ifdef airgradient
4343
/* use https://github.com/geerlingguy/internet-pi to store values */
4444
#include <WebServer.h>
45-
#include <SPIFFS.h>
4645
const int port = 9925;
4746
WebServer server(port);
4847
#endif /* airgradient */
@@ -83,6 +82,8 @@ SensirionI2CScd4x scd4x;
8382
#error This sketch should be used when USB is in OTG mode and MSC On Boot enabled
8483
#endif
8584
#include "USB.h"
85+
#include <USBMSC.h>
86+
USBMSC usbmsc;
8687

8788
RTC_DATA_ATTR bool USB_ACTIVE = false, initDone = false, BatteryMode = false, comingFromDeepSleep = false;
8889
RTC_DATA_ATTR bool LEDonBattery, LEDonUSB, useSmoothLEDcolor, invertDisplay, useFahrenheit, useWiFi, english;
@@ -100,7 +101,7 @@ RTC_DATA_ATTR uint16_t currentIndex = 0;
100101
RTC_DATA_ATTR bool overflow = false;
101102
#define NUM_MEASUREMENTS (24*120)
102103
RTC_DATA_ATTR uint16_t co2measurements[NUM_MEASUREMENTS]; // every 30 sec
103-
RTC_DATA_ATTR tempHumData tempHumMeasurements[NUM_MEASUREMENTS / 3]; // every 1.5 minutes
104+
RTC_DATA_ATTR tempHumData tempHumMeasurements[NUM_MEASUREMENTS / 4]; // every 2 minutes
104105

105106
/* WIFI */
106107
bool shouldSaveConfig = false;
@@ -175,13 +176,13 @@ void HandleRootClient() {
175176

176177
String message = "<!DOCTYPE html>\n <html>\n";
177178
message += "<head>\n <title>OpenCO2 Sensor</title>\n <link rel='icon' href='/favicon.ico' type='image/png' />\n <meta http-equiv='refresh' content='300'>\n";
178-
message += "<style> .container { display: flex; gap: 15px; } .rounded-box { font-family: Verdana, Geneva, sans-serif; width: 400px; height: 300px; border-radius: 25px; position: relative; display: flex; flex-direction: column; justify-content: center; font-size: 4em; border: 4px solid #ccc; } .descr-text { position: absolute; top: 10px; left: 10px; font-size: 0.5em; } .center-text { font-size: 1.5em; text-align: center; } .unit-text { font-size: 0.5em; } </style>";
179+
message += "<style> .container { display: flex; gap: 15px; } .rounded-box { font-family: Verdana, Geneva, sans-serif; width: 400px; height: 300px; border-radius: 25px; position: relative; display: flex; flex-direction: column; justify-content: center; font-size: 4em; border: 4px solid grey; } .descr-text { position: absolute; top: 10px; left: 10px; font-size: 0.5em; } .center-text { font-size: 1.5em; text-align: center; } .unit-text { font-size: 0.5em; } </style>";
179180
message += "</head>\n";
180181

181182
message += "<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>\n";
182-
message += "<body>\n";
183+
message += "<body style='color: grey; background: black;'>\n";
183184

184-
message += "<div class='container'><div class='rounded-box' style='background-color:#" + getHexColors(co2) + "; color:#FFFFFF;'><div class='descr-text'>CO2</div><div class='center-text'><b>" + String(co2) + "</b><div class='unit-text'>ppm</div></div></div>\n";
185+
message += "<div class='container'><div class='rounded-box' style='background-color:#" + getHexColors(co2) + "; color:'grey';'><div class='descr-text'>CO2</div><div class='center-text'><b>" + String(co2) + "</b><div class='unit-text'>ppm</div></div></div>\n";
185186
char tempString[6];
186187
if (useFahrenheit) sprintf(tempString, "%.1f",(temperature * 1.8f) + 32.0f); // convert to °F
187188
else sprintf(tempString, "%.1f", temperature);
@@ -228,12 +229,12 @@ void HandleRootClient() {
228229

229230
message = "];\n";
230231
message += "const data = [{x:times, y:yValues, mode:'lines'}];\n";
231-
message += "const layout = {yaxis: { title: 'CO2 (ppm)'}, title: 'History'};\n";
232+
message += "const layout = {yaxis: { title: 'CO2 (ppm)'}, title: 'History', plot_bgcolor:'black', paper_bgcolor:'black'};\n";
232233
message += "Plotly.newPlot('CO2Plot', data, layout);\n";
233234
server.sendContent(message);
234235

235236
Buffer = "const y1Values = [";
236-
index = index / 3.0;
237+
index = index / 4.0;
237238
for (int i = 0; i < index; i++) {
238239
if (useFahrenheit) sprintf(tempString, "%.1f",(getTempMeasurement(i)/10.0 * 1.8f) + 32.0f); // convert to °F
239240
else sprintf(tempString, "%.1f", getTempMeasurement(i)/10.0);
@@ -262,12 +263,12 @@ void HandleRootClient() {
262263
message += "const data2 = [{x: times2, y: y1Values, name: 'Temperature', mode:'lines'}, ";
263264
message += "{x: times2, y: y2Values, name: 'Humidity', yaxis: 'y2', mode:'lines'}];\n";
264265
message += "const layout2 = { showlegend: false, yaxis: {title: 'Temperature (" + String(useFahrenheit? "*F" : "*C") ;
265-
message += ")'}, yaxis2: { title: 'Humidity (%)', overlaying: 'y', side: 'right'}};\n";
266+
message += ")'}, yaxis2: { title: 'Humidity (%)', overlaying: 'y', side: 'right'}, plot_bgcolor:'black', paper_bgcolor:'black'};\n";
266267
message += "Plotly.newPlot('TempHumPlot', data2, layout2);\n";
267268

268269
message += "</script>\n</body>\n</html>\n";
269270
server.sendContent(message);
270-
server.client().stop();
271+
server.sendContent(""); // Send finish
271272
}
272273

273274
void HandleRoot() {
@@ -353,6 +354,7 @@ void initOnce() {
353354
LEDonUSB = preferences.getBool("LEDonUSB", true);
354355
ledbrightness = preferences.getInt("ledbrightness", 5);
355356
font = preferences.getInt("font", 0);
357+
if (font == 2) font = 1; // remove gotham font
356358
changeFont(font);
357359
useSmoothLEDcolor = preferences.getBool("useSmoothLEDcolor", true);
358360
invertDisplay = preferences.getBool("invertDisplay", false);
@@ -436,13 +438,6 @@ void lowBatteryMode() {
436438
rtc_gpio_pullup_dis(USB_PRESENT);
437439
rtc_gpio_pulldown_dis(USB_PRESENT);
438440
esp_sleep_enable_ext0_wakeup(USB_PRESENT, 1);
439-
440-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_AUTO); // RTC IO, sensors and ULP co-processor
441-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_AUTO); // RTC slow memory: auto
442-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); // RTC fast memory
443-
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF); // XTAL oscillator
444-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC8M, ESP_PD_OPTION_OFF); // CPU core
445-
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
446441
esp_deep_sleep_start();
447442
}
448443

@@ -455,12 +450,6 @@ void goto_deep_sleep(int ms) {
455450
}
456451

457452
esp_sleep_enable_timer_wakeup(ms * 1000); // periodic measurement every 30 sec - 0.83 sec awake
458-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_AUTO); // RTC IO, sensors and ULP co-processor
459-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_AUTO); // RTC slow memory: auto
460-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); // RTC fast memory
461-
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF); // XTAL oscillator
462-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC8M, ESP_PD_OPTION_OFF); // CPU core
463-
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
464453

465454
/* Wakeup by usb power */
466455
rtc_gpio_pullup_dis(USB_PRESENT);
@@ -470,12 +459,16 @@ void goto_deep_sleep(int ms) {
470459
/* Wakeup by IO0 button */
471460
rtc_gpio_pullup_en(BUTTON);
472461
rtc_gpio_pulldown_dis(BUTTON);
473-
esp_sleep_enable_ext1_wakeup(0x1, ESP_EXT1_WAKEUP_ALL_LOW); // 2^0 = GPIO_NUM_0 = BUTTON
462+
esp_sleep_enable_ext1_wakeup_io((1ULL << BUTTON), ESP_EXT1_WAKEUP_ANY_LOW);
474463

475464
/* Keep LED enabled */
476465
if (LEDonBattery) gpio_hold_en(LED_POWER);
477466
else gpio_hold_dis(LED_POWER);
478467

468+
/* Keep Display power enabled
469+
gpio_hold_en(DISPLAY_POWER);
470+
gpio_deep_sleep_hold_en();*/
471+
479472
comingFromDeepSleep = true;
480473
esp_deep_sleep_start();
481474
}
@@ -518,12 +511,6 @@ void goto_light_sleep(int ms) {
518511
esp_sleep_enable_gpio_wakeup();
519512

520513
esp_sleep_enable_timer_wakeup(ms * 1000); // periodic measurement every 5 sec -1.1 sec awake
521-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_AUTO); // RTC IO, sensors and ULP co-processor
522-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_AUTO); // RTC slow memory: auto
523-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); // RTC fast memory
524-
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF); // XTAL oscillator
525-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC8M, ESP_PD_OPTION_OFF); // CPU core
526-
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
527514
esp_light_sleep_start();
528515
}
529516
}
@@ -628,9 +615,9 @@ void rainbowMode() {
628615

629616
void saveMeasurement(uint16_t co2, float temperature, float humidity) {
630617
co2measurements[currentIndex] = co2;
631-
if (!(currentIndex % 3)) { // every 1.5 minutes
632-
tempHumMeasurements[currentIndex / 3].temperature = (uint16_t)(temperature * 10);
633-
tempHumMeasurements[currentIndex / 3].humidity = (uint8_t) humidity;
618+
if (!(currentIndex % 4)) { // every 2 minutes
619+
tempHumMeasurements[currentIndex / 4].temperature = (uint16_t)(temperature * 10);
620+
tempHumMeasurements[currentIndex / 4].humidity = (uint8_t) humidity;
634621
}
635622

636623
currentIndex++;
@@ -646,11 +633,11 @@ uint16_t getCO2Measurement(uint16_t index) {
646633
}
647634
uint16_t getTempMeasurement(uint16_t index) {
648635
if (!overflow) return tempHumMeasurements[index].temperature;
649-
else return tempHumMeasurements[(int)(ceil(currentIndex/3.0) + index) % (NUM_MEASUREMENTS/3)].temperature;
636+
else return tempHumMeasurements[(int)(ceil(currentIndex/4.0) + index) % (NUM_MEASUREMENTS/4)].temperature;
650637
}
651638
uint8_t getHumMeasurement(uint16_t index) {
652639
if (!overflow) return tempHumMeasurements[index].humidity;
653-
else return tempHumMeasurements[(int)(ceil(currentIndex/3.0) + index) % (NUM_MEASUREMENTS/3)].humidity;
640+
else return tempHumMeasurements[(int)(ceil(currentIndex/4.0) + index) % (NUM_MEASUREMENTS/4)].humidity;
654641
}
655642

656643
void handleWiFiChange() {
@@ -716,6 +703,7 @@ void startWiFi() {
716703

717704
WiFi.setHostname("OpenCO2"); // hostname when connected to home network
718705
wifiManager.setConfigPortalBlocking(false);
706+
wifiManager.setClass("invert"); // dark theme
719707
wifiManager.setWiFiAutoReconnect(true);
720708
wifiManager.autoConnect("OpenCO2 Sensor"); // name of broadcasted SSID
721709

@@ -764,6 +752,7 @@ void setup() {
764752
scd4x.begin(Wire);
765753

766754
USB.onEvent(usbEventCallback);
755+
usbmsc.isWritable(true);
767756
if (!initDone) initOnce();
768757

769758
#if ARDUINO_USB_CDC_ON_BOOT && !ARDUINO_USB_MODE

epd_abstraction.ino

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ extern bool BatteryMode, comingFromDeepSleep;
3333
extern uint8_t HWSubRev;
3434

3535
extern uint8_t font;
36-
sFONT fonts[3][3] = {
36+
sFONT fonts[2][3] = {
3737
bahn_big, bahn_mid, bahn_sml,
38-
gotham_big, gotham_mid, gotham_sml,
38+
//gotham_big, gotham_mid, gotham_sml,
3939
nothing_big, nothing_mid, bahn_sml
4040
};
4141
sFONT big=fonts[font][0];
@@ -230,7 +230,7 @@ void OptionsMenu() {
230230
break;
231231
case FONT:
232232
font += 1;
233-
font %= 3;
233+
font %= 2;
234234
changeFont(font);
235235
preferences.begin("co2-sensor", false);
236236
preferences.putInt("font", font);
@@ -328,13 +328,6 @@ void displayWelcome() {
328328
EPD_4IN2_Display(BlackImage);
329329
EPD_4IN2_Sleep();
330330
#endif*/
331-
332-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF); // RTC IO, sensors and ULP co-processor
333-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF); // RTC slow memory: auto
334-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); // RTC fast memory
335-
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_OFF); // XTAL oscillator
336-
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC8M, ESP_PD_OPTION_OFF); // CPU core
337-
esp_sleep_pd_config(ESP_PD_DOMAIN_VDDSDIO, ESP_PD_OPTION_OFF);
338331
esp_deep_sleep_start();
339332
}
340333

@@ -535,8 +528,8 @@ void calculateTempHumStats(int* mintemp, int* maxtemp, int* avgtemp, int* minhum
535528
*maxhum = value;
536529

537530
uint16_t index;
538-
if (overflow) index = NUM_MEASUREMENTS / 3;
539-
else index = ceil(currentIndex / 3.0);
531+
if (overflow) index = NUM_MEASUREMENTS / 4;
532+
else index = ceil(currentIndex / 4.0);
540533
for (int i=0; i<index; i++) {
541534
value = getTempMeasurement(i);
542535
if (value < *mintemp) *mintemp = value;
@@ -617,8 +610,8 @@ void displayTempHumHistoryGraph() {
617610
float yscaletemp = hight / (maxtemp - mintemp);
618611
float yscalehum = hight / (maxhum - minhum);
619612
uint16_t index;
620-
if (overflow) index = NUM_MEASUREMENTS / 3;
621-
else index = ceil(currentIndex / 3.0);
613+
if (overflow) index = NUM_MEASUREMENTS / 4;
614+
else index = ceil(currentIndex / 4.0);
622615
float stepsPerPixel = index / (float)WIDTH;
623616

624617
Paint_Clear(WHITE);
@@ -799,7 +792,7 @@ void displayOptionsMenu(uint8_t selectedOption) {
799792
}
800793
Paint_DrawString_EN(166, 50, (useFahrenheit? "*F":"*C"), &Font24, WHITE, BLACK);
801794
Paint_DrawNum(149, 100, (int32_t)(font+1), &Font24, BLACK, WHITE);
802-
Paint_DrawString_EN(166, 100, "/3", &Font24, WHITE, BLACK);
795+
Paint_DrawString_EN(166, 100, "/2", &Font24, WHITE, BLACK);
803796

804797
invertSelected(selectedOption);
805798
updateDisplay();

esp32-waveshare-epd/src/GUI_Paint.cpp

Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -251,61 +251,13 @@ void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
251251

252252
Rdata = Rdata & (~(0xC0 >> ((X % 4)*2)));
253253
Paint.Image[Addr] = Rdata | ((Color << 6) >> ((X % 4)*2));
254-
}else if(Paint.Scale == 7){
255-
UWORD Width = Paint.WidthMemory*3%8 == 0 ? Paint.WidthMemory*3/8 : Paint.WidthMemory*3/8+1;
256-
UDOUBLE Addr = (Xpoint * 3) / 8 + Ypoint * Width;
257-
UBYTE shift, Rdata, Rdata2;
258-
shift = (Xpoint+Ypoint*Paint.HeightMemory) % 8;
259-
260-
switch(shift) {
261-
case 0 :
262-
Rdata = Paint.Image[Addr] & 0x1f;
263-
Rdata = Rdata | ((Color << 5) & 0xe0);
264-
Paint.Image[Addr] = Rdata;
265-
break;
266-
case 1 :
267-
Rdata = Paint.Image[Addr] & 0xe3;
268-
Rdata = Rdata | ((Color << 2) & 0x1c);
269-
Paint.Image[Addr] = Rdata;
270-
break;
271-
case 2 :
272-
Rdata = Paint.Image[Addr] & 0xfc;
273-
Rdata2 = Paint.Image[Addr + 1] & 0x7f;
274-
Rdata = Rdata | ((Color >> 1) & 0x03);
275-
Rdata2 = Rdata2 | ((Color << 7) & 0x80);
276-
Paint.Image[Addr] = Rdata;
277-
Paint.Image[Addr + 1] = Rdata2;
278-
break;
279-
case 3 :
280-
Rdata = Paint.Image[Addr] & 0x8f;
281-
Rdata = Rdata | ((Color << 4) & 0x70);
282-
Paint.Image[Addr] = Rdata;
283-
break;
284-
case 4 :
285-
Rdata = Paint.Image[Addr] & 0xf1;
286-
Rdata = Rdata | ((Color << 1) & 0x0e);
287-
Paint.Image[Addr] = Rdata;
288-
break;
289-
case 5 :
290-
Rdata = Paint.Image[Addr] & 0xfe;
291-
Rdata2 = Paint.Image[Addr + 1] & 0x3f;
292-
Rdata = Rdata | ((Color >> 2) & 0x01);
293-
Rdata2 = Rdata2 | ((Color << 6) & 0xc0);
294-
Paint.Image[Addr] = Rdata;
295-
Paint.Image[Addr + 1] = Rdata2;
296-
break;
297-
case 6 :
298-
Rdata = Paint.Image[Addr] & 0xc7;
299-
Rdata = Rdata | ((Color << 3) & 0x38);
300-
Paint.Image[Addr] = Rdata;
301-
break;
302-
case 7 :
303-
Rdata = Paint.Image[Addr] & 0xf8;
304-
Rdata = Rdata | (Color & 0x07);
305-
Paint.Image[Addr] = Rdata;
306-
break;
307-
}
308-
}
254+
}else if(Paint.Scale == 7 || Paint.Scale == 16){
255+
UDOUBLE Addr = X / 2 + Y * Paint.WidthByte;
256+
UBYTE Rdata = Paint.Image[Addr];
257+
Rdata = Rdata & (~(0xF0 >> ((X % 2)*4)));//Clear first, then set value
258+
Paint.Image[Addr] = Rdata | ((Color << 4) >> ((X % 2)*4));
259+
// printf("Add = %d ,data = %d\r\n",Addr,Rdata);
260+
}
309261
}
310262

311263
/******************************************************************************
@@ -315,26 +267,25 @@ function: Clear the color of the picture
315267
******************************************************************************/
316268
void Paint_Clear(UWORD Color)
317269
{
318-
if(Paint.Scale == 2 || Paint.Scale == 4) {
270+
if(Paint.Scale == 2) {
319271
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
320272
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel = 1 byte
321273
UDOUBLE Addr = X + Y*Paint.WidthByte;
322274
Paint.Image[Addr] = Color;
323275
}
324276
}
325-
}
326-
if(Paint.Scale == 7) {
327-
Color = (UBYTE)Color;
328-
UWORD Width = (Paint.WidthMemory * 3 % 8 == 0)? (Paint.WidthMemory * 3 / 8 ): (Paint.WidthMemory * 3 / 8 + 1);
277+
}else if(Paint.Scale == 4) {
278+
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
279+
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {
280+
UDOUBLE Addr = X + Y*Paint.WidthByte;
281+
Paint.Image[Addr] = (Color<<6)|(Color<<4)|(Color<<2)|Color;
282+
}
283+
}
284+
}else if(Paint.Scale == 7 || Paint.Scale == 16) {
329285
for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
330-
for (UWORD X = 0; X < Width; X++ ) {
331-
UDOUBLE Addr = X + Y * Width;
332-
if((X + Y * Width)%3 == 0)
333-
Paint.Image[Addr] = ((Color<<5) | (Color<<2) | (Color>>1));
334-
else if((X + Y * Width)%3 == 1)
335-
Paint.Image[Addr] = ((Color<<7) | (Color<<4) | (Color<<1) | (Color>>2));
336-
else if((X + Y * Width)%3 == 2)
337-
Paint.Image[Addr] = ((Color<<6) | (Color<<3) | Color);
286+
for (UWORD X = 0; X < Paint.WidthByte; X++ ) {
287+
UDOUBLE Addr = X + Y*Paint.WidthByte;
288+
Paint.Image[Addr] = (Color<<4)|Color;
338289
}
339290
}
340291
}

0 commit comments

Comments
 (0)