Skip to content

Commit c55fc59

Browse files
Clean up and fix warning in SteelSeriesApexController
1 parent b68b63e commit c55fc59

1 file changed

Lines changed: 34 additions & 21 deletions

File tree

Controllers/SteelSeriesController/SteelSeriesApexController/SteelSeriesApexController.cpp

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
7373
if(use_new_protocol)
7474
{
7575
struct hid_device_info* info = hid_get_device_info(dev);
76-
if(info && (info->product_id == 0x162C || info->product_id == 0x162D)) // Aparently Gen 3 wireless models reuse this protocol, make sure to place their PID here and further below when developing.
76+
77+
/*-------------------------------------------------*\
78+
| Apparently Gen 3 wireless models reuse this |
79+
| protocol, make sure to place their PID here and |
80+
| further below when developing. |
81+
\*-------------------------------------------------*/
82+
if(info && (info->product_id == 0x162C || info->product_id == 0x162D))
7783
{
7884
packet_id = APEX_2023_PACKET_ID_DIRECT_WIRELESS;
7985
}
@@ -112,10 +118,9 @@ void SteelSeriesApexController::SetLEDsDirect(std::vector<RGBColor> colors)
112118
hid_send_feature_report(dev, buf, 643);
113119
}
114120

115-
/*-------------------------------------------------------------------------------------------------*\
116-
| Private packet sending functions. |
117-
\*-------------------------------------------------------------------------------------------------*/
118-
121+
/*---------------------------------------------------------*\
122+
| Private packet sending functions. |
123+
\*---------------------------------------------------------*/
119124
void SteelSeriesApexController::SelectProfile
120125
(
121126
unsigned char profile
@@ -138,35 +143,37 @@ void SteelSeriesApexController::SendInitialization()
138143
unsigned char buf[FIRMWARE_REQ_LEN];
139144
unsigned char read_buf[65];
140145
int res = 0;
141-
char version_str[32] = "Unknown";
146+
char version_str[65] = "Unknown";
142147

143148
struct hid_device_info* info = hid_get_device_info(dev);
144149
unsigned short pid = (info) ? info->product_id : 0;
145150

146-
// Firmware check
151+
/*-----------------------------------------------------*\
152+
| Firmware check |
153+
\*-----------------------------------------------------*/
147154
if(pid == 0x1628)
148155
{
149-
/*-----------------------------------------------------*\
150-
| Zero out buffer |
151-
\*-----------------------------------------------------*/
156+
/*-------------------------------------------------*\
157+
| Zero out buffer |
158+
\*-------------------------------------------------*/
152159
memset(buf, 0x00, sizeof(buf));
153160
buf[0x00] = 0x00;
154161
buf[0x01] = 0x90;
155162

156-
/*-----------------------------------------------------*\
157-
| Send packet |
158-
\*-----------------------------------------------------*/
163+
/*-------------------------------------------------*\
164+
| Send packet |
165+
\*-------------------------------------------------*/
159166
hid_write(dev, buf, 65);
160167

161-
/*-----------------------------------------------------*\
162-
| Read Response |
163-
\*-----------------------------------------------------*/
168+
/*-------------------------------------------------*\
169+
| Read Response |
170+
\*-------------------------------------------------*/
164171
memset(read_buf, 0x00, sizeof(read_buf));
165172
res = hid_read_timeout(dev, read_buf, sizeof(read_buf), 200);
166173

167-
/*-----------------------------------------------------*\
168-
| Firmware Check |
169-
\*-----------------------------------------------------*/
174+
/*-------------------------------------------------*\
175+
| Firmware Check |
176+
\*-------------------------------------------------*/
170177
if(res > 2 && read_buf[0] == 0x90)
171178
{
172179
int major = 0, minor = 0, patch = 0;
@@ -178,7 +185,9 @@ void SteelSeriesApexController::SendInitialization()
178185

179186
if(count == 3)
180187
{
181-
// Currently set to 1.19.7 or newer.
188+
/*-----------------------------------------*\
189+
| Currently set to 1.19.7 or newer. |
190+
\*-----------------------------------------*/
182191
if(major > 1)
183192
{
184193
use_new_protocol = true;
@@ -197,7 +206,11 @@ void SteelSeriesApexController::SendInitialization()
197206
}
198207
}
199208
}
200-
// // Aparently Gen 3 models reuse this protocol, make sure to place their PID here and further above for wireless when developing.
209+
/*-----------------------------------------------------*\
210+
| Apparently Gen 3 models reuse this protocol, make |
211+
| sure to place their PID here and further above for |
212+
| wireless when developing. |
213+
\*-----------------------------------------------------*/
201214
else if(pid == 0x162C || pid == 0x162D)
202215
{
203216
use_new_protocol = true;

0 commit comments

Comments
 (0)