Skip to content

Commit 1943f28

Browse files
authored
Add ttyACM detection
1 parent 14d8157 commit 1943f28

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

sources/leddevice/dev_serial/EspTools.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EspTools
3838
_rs232Port.write((char*)comBuffer, sizeof(comBuffer));
3939
}
4040

41-
static void initializeEsp(QSerialPort& _rs232Port, QSerialPortInfo& serialPortInfo, Logger*& _log)
41+
static void initializeEsp(QSerialPort& _rs232Port, QSerialPortInfo& serialPortInfo, Logger*& _log, bool _forceSerialDetection)
4242
{
4343
uint8_t comBuffer[] = { 0x41, 0x77, 0x41, 0x2a, 0xa2, 0x15, 0x68, 0x79, 0x70, 0x65, 0x72, 0x68, 0x64, 0x72 };
4444

@@ -75,6 +75,17 @@ class EspTools
7575
_rs232Port.setRequestToSend(true);
7676
_rs232Port.setRequestToSend(false);
7777
}
78+
else if (!serialPortInfo.hasProductIdentifier() && !serialPortInfo.hasVendorIdentifier() && _forceSerialDetection)
79+
{
80+
Warning(_log, "Force ESP/Pico detection override enabled. HyperHDR skips the reset. State: %i, %i",
81+
_rs232Port.isDataTerminalReady(), _rs232Port.isRequestToSend());
82+
83+
_rs232Port.write((char*)comBuffer, sizeof(comBuffer));
84+
85+
_rs232Port.setDataTerminalReady(true);
86+
_rs232Port.setRequestToSend(true);
87+
_rs232Port.setRequestToSend(false);
88+
}
7889
else
7990
{
8091
// reset to defaults

sources/leddevice/dev_serial/ProviderRs232.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ProviderRs232::ProviderRs232(const QJsonObject& deviceConfig)
3232
, _delayAfterConnect_ms(0)
3333
, _frameDropCounter(0)
3434
, _espHandshake(true)
35+
, _forceSerialDetection(true)
3536
{
3637
}
3738

@@ -58,11 +59,13 @@ bool ProviderRs232::init(const QJsonObject& deviceConfig)
5859
_delayAfterConnect_ms = deviceConfig["delayAfterConnect"].toInt(0);
5960
_espHandshake = deviceConfig["espHandshake"].toBool(false);
6061
_maxRetry = _devConfig["maxRetry"].toInt(60);
62+
_forceSerialDetection = deviceConfig["forceSerialDetection"].toBool(false);
6163

6264
Debug(_log, "Device name : %s", QSTRING_CSTR(_deviceName));
6365
Debug(_log, "Auto selection: %d", _isAutoDeviceName);
6466
Debug(_log, "Baud rate : %d", _baudRate_Hz);
6567
Debug(_log, "ESP handshake : %s", (_espHandshake) ? "ON" : "OFF");
68+
Debug(_log, "Force ESP/Pico Detection : %s", (_forceSerialDetection) ? "ON" : "OFF");
6669
Debug(_log, "Delayed open : %d", _delayAfterConnect_ms);
6770
Debug(_log, "Retry limit : %d", _maxRetry);
6871

@@ -246,7 +249,7 @@ bool ProviderRs232::tryOpen(int delayAfterConnect_ms)
246249
{
247250
disconnect(&_rs232Port, &QSerialPort::readyRead, nullptr, nullptr);
248251

249-
EspTools::initializeEsp(_rs232Port, serialPortInfo, _log);
252+
EspTools::initializeEsp(_rs232Port, serialPortInfo, _log, _forceSerialDetection);
250253
}
251254
}
252255
else

sources/leddevice/dev_serial/ProviderRs232.h

+2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ public slots:
119119
int _frameDropCounter;
120120

121121
bool _espHandshake;
122+
123+
bool _forceSerialDetection;
122124
};
123125

124126
#endif // PROVIDERRS232_H

sources/leddevice/schemas/schema-adalight.json

+23-8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@
3535
},
3636
"propertyOrder" : 4
3737
},
38+
"forceSerialDetection" :
39+
{
40+
41+
"type" : "boolean",
42+
"format": "checkbox",
43+
"title" : "edt_dev_spec_forceSerialDetection",
44+
"default" : false,
45+
"required" : true,
46+
"options": {
47+
"dependencies": {
48+
"awa_mode": true
49+
}
50+
},
51+
"propertyOrder" : 5
52+
},
3853
"white_channel_calibration": {
3954
"type": "boolean",
4055
"format": "checkbox",
@@ -46,7 +61,7 @@
4661
"awa_mode": true
4762
}
4863
},
49-
"propertyOrder" : 5
64+
"propertyOrder" : 6
5065
},
5166
"white_channel_limit": {
5267
"type": "number",
@@ -63,7 +78,7 @@
6378
"white_channel_calibration": true
6479
}
6580
},
66-
"propertyOrder" : 6
81+
"propertyOrder" : 7
6782
},
6883
"white_channel_red": {
6984
"type": "integer",
@@ -79,7 +94,7 @@
7994
"white_channel_calibration": true
8095
}
8196
},
82-
"propertyOrder" : 7
97+
"propertyOrder" : 8
8398
},
8499
"white_channel_green": {
85100
"type": "integer",
@@ -95,7 +110,7 @@
95110
"white_channel_calibration": true
96111
}
97112
},
98-
"propertyOrder" : 8
113+
"propertyOrder" : 9
99114
},
100115
"white_channel_blue": {
101116
"type": "integer",
@@ -111,7 +126,7 @@
111126
"white_channel_calibration": true
112127
}
113128
},
114-
"propertyOrder" : 9
129+
"propertyOrder" : 10
115130
},
116131
"delayAfterConnect": {
117132
"type": "integer",
@@ -124,7 +139,7 @@
124139
"awa_mode": false
125140
}
126141
},
127-
"propertyOrder" : 10
142+
"propertyOrder" : 11
128143
},
129144
"lightberry_apa102_mode": {
130145
"type": "boolean",
@@ -137,7 +152,7 @@
137152
"awa_mode": false
138153
}
139154
},
140-
"propertyOrder" : 11
155+
"propertyOrder" : 12
141156
},
142157
"maxRetry":
143158
{
@@ -149,7 +164,7 @@
149164
"maximum" : 120,
150165
"default" : 0,
151166
"required" : true,
152-
"propertyOrder" : 12
167+
"propertyOrder" : 13
153168
}
154169
},
155170
"additionalProperties": true

www/i18n/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@
11991199
"edt_serial_espHandshake" : "Esp8266/ESP32/Rp2040 handshake (<a href='https://github.com/awawa-dev/HyperHDR/wiki/HyperSerial' style='color:red'>info</a>)",
12001200
"edt_rpi_ws281x_driver" : "This driver is intended for advanced users and is <b>not recommended or supported</b> by the HyperHDR team. Please read the project FAQ section for reasons and don't ask us for help if you try to use it because it <b>revokes any support for your entire HyperHDR configuration</b>. Choose a better solution like HyperSerialEsp8266/HyperSerialESP32 (<a href='https://github.com/awawa-dev/HyperHDR/wiki/HyperSerial' style='color:red'>about</a>) or HyperSPI (<a href='https://github.com/awawa-dev/HyperSPI' style='color:red'>about</a>).",
12011201
"edt_dev_spec_awa_mode_title": "High speed serial AWA protocol with data integrity check (<a href='https://github.com/awawa-dev/HyperHDR/wiki/HyperSerial' style='color:red'>info</a>)",
1202+
"edt_dev_spec_forceSerialDetection": "Force ttyACM detection (for webOS: if serial port info returns empty)",
12021203
"led_editor_context_identify": "Identify",
12031204
"main_menu_grabber_lut" : "Download LUT",
12041205
"main_menu_grabber_lut_title" : "Custom LUT for USB grabber",

0 commit comments

Comments
 (0)