@@ -91,12 +91,7 @@ namespace ExtUI {
91
91
rtscheck.recdat .head [1 ] = rtscheck.snddat .head [1 ] = FHTWO;
92
92
memset (rtscheck.databuf , 0 , sizeof (rtscheck.databuf ));
93
93
94
- #if ENABLED(DWINOS_4)
95
- #define DWIN_BOOTUP_DELAY 1500
96
- #else
97
- #define DWIN_BOOTUP_DELAY 500
98
- #endif
99
- delay_ms (DWIN_BOOTUP_DELAY); // Delay to allow screen startup
94
+ delay_ms (TERN (DWINOS_4, 1500 , 500 )); // Delay to allow screen startup
100
95
SetTouchScreenConfiguration ();
101
96
rtscheck.RTS_SndData (StartSoundSet, SoundAddr);
102
97
delay_ms (400 ); // Delay to allow screen to configure
@@ -1684,14 +1679,15 @@ namespace ExtUI {
1684
1679
}
1685
1680
break ;
1686
1681
1687
- #if ENABLED(POWER_LOSS_RECOVERY)
1688
- case PwrOffNoF:
1689
- if (recdat.data [0 ] == 1 ) // Yes:continue to print the 3Dmode during power-off.
1690
- injectCommands (F (" M1000" ));
1691
- else if (recdat.data [0 ] == 2 ) // No
1692
- injectCommands (F (" M1000C" ));
1693
- break ;
1694
- #endif
1682
+ #if ENABLED(POWER_LOSS_RECOVERY)
1683
+ case PwrOffNoF:
1684
+ if (recdat.data [0 ] == 1 ) // Yes: continue to print the 3Dmode during power-off.
1685
+ injectCommands (F (" M1000" ));
1686
+ else if (recdat.data [0 ] == 2 ) // No
1687
+ injectCommands (F (" M1000C" ));
1688
+ break ;
1689
+ #endif
1690
+
1695
1691
case Volume:
1696
1692
if (recdat.data [0 ] < 0 )
1697
1693
Settings.display_volume = 0 ;
@@ -1855,8 +1851,7 @@ namespace ExtUI {
1855
1851
break ;
1856
1852
}
1857
1853
1858
- case AutolevelVal:
1859
- {
1854
+ case AutolevelVal: {
1860
1855
uint8_t meshPoint = (recdat.addr - AutolevelVal) / 2 ;
1861
1856
uint8_t yPnt = floor (meshPoint / GRID_MAX_POINTS_X);
1862
1857
uint8_t xPnt;
@@ -1895,7 +1890,7 @@ namespace ExtUI {
1895
1890
1896
1891
void WriteVariable (uint16_t adr, const void * values, uint8_t valueslen, bool isstr=false , char fillChar=' ' ) {
1897
1892
const char * myvalues = static_cast <const char *>(values);
1898
- bool strend = !myvalues;
1893
+ bool strend = !myvalues;
1899
1894
DWIN_SERIAL.write (FHONE);
1900
1895
DWIN_SERIAL.write (FHTWO);
1901
1896
DWIN_SERIAL.write (valueslen + 3 );
@@ -1907,7 +1902,7 @@ namespace ExtUI {
1907
1902
if (!strend) x = *myvalues++;
1908
1903
if ((isstr && !x) || strend) {
1909
1904
strend = true ;
1910
- x = fillChar;
1905
+ x = fillChar;
1911
1906
}
1912
1907
DWIN_SERIAL.write (x);
1913
1908
}
@@ -1918,29 +1913,19 @@ namespace ExtUI {
1918
1913
LIMIT (Settings.screen_brightness , 10 , 100 ); // Prevent a possible all-dark screen
1919
1914
LIMIT (Settings.standby_time_seconds , 10 , 655 ); // Prevent a possible all-dark screen for standby, yet also don't go higher than the DWIN limitation
1920
1915
1921
-
1922
- unsigned char cfg_bits = 0x0 ;
1923
- // #if ENABLED(DWINOS_4)
1924
- cfg_bits |= 1UL << 7 ; // 7: Enable Control
1925
- // #endif
1926
- cfg_bits |= 1UL << 5 ; // 5: load 22 touch file
1927
- cfg_bits |= 1UL << 4 ; // 4: auto-upload should always be enabled
1928
- if (Settings.display_sound ) cfg_bits |= 1UL << 3 ; // 3: audio
1929
- if (Settings.display_standby ) cfg_bits |= 1UL << 2 ; // 2: backlight on standby
1930
- if (Settings.screen_rotation == 10 ) cfg_bits |= 1UL << 1 ; // 1 & 0: Inversion
1931
- #if ANY(MachineCR10Smart, MachineCR10SmartPro )
1932
- cfg_bits |= 1UL << 0 ; // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display
1933
- #endif
1934
-
1935
-
1936
-
1937
- const unsigned char config_set[] = {
1938
- #if ENABLED(DWINOS_4)
1939
- 0x5A , 0x00 , (unsigned char )(cfg_bits >> 8U ), (unsigned char )(cfg_bits & 0xFFU )
1940
- #else
1941
- 0x5A , 0x00 , 0xFF , cfg_bits
1942
- #endif
1943
- };
1916
+ unsigned char cfg_bits = 0x0
1917
+ | _BV (7 ) // 7: Enable Control ... TERN0(DWINOS_4, _BV(7))
1918
+ | _BV (5 ) // 5: load 22 touch file
1919
+ | _BV (4 ) // 4: auto-upload should always be enabled
1920
+ | (Settings.display_sound ? _BV (3 ) : 0 ) // 3: audio
1921
+ | (Settings.display_standby ? _BV (2 ) : 0 ) // 2: backlight on standby
1922
+ | (Settings.screen_rotation == 10 ? _BV (1 ) : 0 ) // 1 & 0: Inversion
1923
+ #if EITHER(MachineCR10Smart, MachineCR10SmartPro)
1924
+ | _BV (0 ) // Portrait Mode or 800x480 display has 0 point rotated 90deg from 480x272 display
1925
+ #endif
1926
+ ;
1927
+
1928
+ const unsigned char config_set[] = { 0x5A , 0x00 , TERN (DWINOS_4, 0x00 , 0xFF ), cfg_bits };
1944
1929
WriteVariable (0x80 /* System_Config*/ , config_set, sizeof (config_set));
1945
1930
1946
1931
// Standby brightness (LED_Config)
0 commit comments