Skip to content

Commit bd8704a

Browse files
Chr1sNoCalcProgrammer1
authored andcommitted
Adding more DEBUG information
Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
1 parent 79e1233 commit bd8704a

File tree

2 files changed

+35
-30
lines changed

2 files changed

+35
-30
lines changed

Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
\*-----------------------------------------*/
99

1010
#include "RGBController_WootingKeyboard.h"
11+
#include "LogManager.h"
1112

1213
//0xFFFFFFFF indicates an unused entry in matrix
1314
#define NA 0xFFFFFFFF
@@ -30,20 +31,9 @@ static unsigned int matrix_map_full[6][21] =
3031
{ 2, 8, 14, 20, 26, 32, 38, 44, 50, 56, 62, 68, 74, 80, 86, 93, 99, 105, 111, 117, 123},
3132
{ 3, 9, 15, 21, 27, 33, 39, 45, 51, 57, 63, 69, 75, 81, NA, NA, NA, 106, 112, 118, NA},
3233
{ 4, 10, 16, 22, 28, 34, 40, 46, 52, 58, 64, 70, NA, 82, NA, 94, NA, 107, 113, 119, 125},
33-
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 65, 71, 77, 83, 89, 95, 102, NA, 108, 120, NA}
34+
{ 5, 11, 17, NA, NA, NA, 41, NA, NA, NA, 65, 71, 77, 83, 89, 95, 102, NA, 114, 120, NA}
3435
};
3536

36-
37-
/*static const char *zone_names[] =
38-
{
39-
"Keyboard"
40-
};
41-
42-
static zone_type zone_types[] =
43-
{
44-
ZONE_TYPE_MATRIX,
45-
};*/
46-
4737
static const unsigned int zone_sizes[] =
4838
{
4939
102,
@@ -160,13 +150,13 @@ static const char *led_names[] =
160150
"Key: Number Pad 7",
161151
"Key: Number Pad 4",
162152
"Key: Number Pad 1",
163-
"Key: Number Pad 0",
153+
"Unused",
164154
"Key: A2",
165155
"Key: Number Pad /", //110
166156
"Key: Number Pad 8",
167157
"Key: Number Pad 5",
168158
"Key: Number Pad 2",
169-
"Unused",
159+
"Key: Number Pad 0",
170160
"Key: A3",
171161
"Key: Number Pad *",
172162
"Key: Number Pad 9",
@@ -185,13 +175,15 @@ RGBController_WootingKeyboard::RGBController_WootingKeyboard(WootingKeyboardCont
185175
{
186176
wooting = wooting_ptr;
187177

178+
LOG_DEBUG("[Wooting KB] Adding meta data");
188179
name = wooting_ptr->GetName();
189180
vendor = wooting_ptr->GetVendor();
190181
type = DEVICE_TYPE_KEYBOARD;
191182
description = wooting_ptr->GetDescription();
192183
location = wooting_ptr->GetLocation();
193184
serial = wooting_ptr->GetSerial();
194185

186+
LOG_DEBUG("[Wooting KB] Adding modes");
195187
mode Direct;
196188
Direct.name = "Direct";
197189
Direct.value = 0xFFFF;
@@ -224,25 +216,31 @@ void RGBController_WootingKeyboard::SetupZones()
224216
uint8_t wooting_type = wooting->GetWootingType();
225217
unsigned int total_led_count = zone_sizes[wooting_type];
226218

227-
/*for (unsigned int zone_idx = 0; zone_idx < 1; zone_idx++)
228-
{*/
229-
zone new_zone;
219+
LOG_DEBUG("[Wooting KB] Creating New Zone");
220+
zone new_zone;
230221

231-
new_zone.name = name.append(" zone");
232-
new_zone.type = ZONE_TYPE_MATRIX;
233-
new_zone.leds_min = total_led_count;
234-
new_zone.leds_max = total_led_count;
235-
new_zone.leds_count = total_led_count;
236-
new_zone.matrix_map = new matrix_map_type;
237-
new_zone.matrix_map->height = 6;
238-
new_zone.matrix_map->width = total_led_count / new_zone.matrix_map->height;
239-
new_zone.matrix_map->map = (wooting_type == WOOTING_KB_TKL) ? (unsigned int *)&matrix_map_tkl : (unsigned int *)&matrix_map_full;
222+
new_zone.name = name.append(" zone");
223+
new_zone.type = ZONE_TYPE_MATRIX;
224+
new_zone.leds_min = total_led_count;
225+
new_zone.leds_max = total_led_count;
226+
new_zone.leds_count = total_led_count;
227+
new_zone.matrix_map = new matrix_map_type;
228+
new_zone.matrix_map->height = 6;
240229

241-
zones.push_back(new_zone);
230+
if(wooting_type == WOOTING_KB_TKL)
231+
{
232+
new_zone.matrix_map->width = 17;
233+
new_zone.matrix_map->map = (unsigned int *)&matrix_map_tkl;
234+
}
235+
else
236+
{
237+
new_zone.matrix_map->width = 21;
238+
new_zone.matrix_map->map = (unsigned int *)&matrix_map_full;
239+
}
242240

243-
//total_led_count += zone_sizes[zone_idx];
244-
//}
241+
zones.push_back(new_zone);
245242

243+
LOG_DEBUG("[Wooting KB] Creating LED array");
246244
for (unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
247245
{
248246
led new_led;
@@ -252,6 +250,8 @@ void RGBController_WootingKeyboard::SetupZones()
252250
leds.push_back(new_led);
253251
}
254252

253+
LOG_DEBUG("[Wooting KB V2] LEDs created - Initialising Colours");
254+
255255
SetupColors();
256256
}
257257

Controllers/WootingKeyboardController/WootingKeyboardControllerDetect.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ void DetectWootingKeyboardControllers(hid_device_info* info, const std::string&
2929
if(dev)
3030
{
3131
uint8_t wooting_type = (info->product_id == WOOTING_ONE_PID) ? WOOTING_KB_TKL : WOOTING_KB_FULL;
32-
32+
33+
LOG_DEBUG("[Wooting KB] Device type %i opened - creating Controller", wooting_type);
3334
WootingKeyboardController* controller = new WootingKeyboardController(dev, info->path, wooting_type);
35+
36+
LOG_DEBUG("[Wooting KB] Controller created - creating RGBController");
3437
RGBController_WootingKeyboard* rgb_controller = new RGBController_WootingKeyboard(controller);
3538
rgb_controller->name = name;
39+
40+
LOG_DEBUG("[Wooting KB] Initialization complete - Registering controller\t%s", name.c_str());
3641
ResourceManager::get()->RegisterRGBController(rgb_controller);
3742
}
3843
} /* DetectWootingKeyboardControllers */

0 commit comments

Comments
 (0)