Fix warnings in QMK OpenRGB controller

This commit is contained in:
Adam Honse 2024-11-26 00:32:10 -06:00
parent ac802b1aa8
commit b4ee1f0fb8
5 changed files with 37 additions and 36 deletions

View file

@ -331,7 +331,7 @@ void RGBController_QMKOpenRGBRev9::SetupZones()
VectorMatrix underglow_map;
PlaceLEDsInMaps(rows, columns, divisor, led_points, led_flags, matrix_map, underglow_map);
CleanMatrixMaps(matrix_map, underglow_map, rows.size(), has_underglow);
CleanMatrixMaps(matrix_map, underglow_map, (unsigned int)rows.size(), has_underglow);
/*---------------------------------------------------------*\
| These vectors are class members because if they go out of |
@ -351,8 +351,8 @@ void RGBController_QMKOpenRGBRev9::SetupZones()
keys_zone.leds_max = keys_zone.leds_min;
keys_zone.leds_count = keys_zone.leds_min;
keys_zone.matrix_map = new matrix_map_type;
keys_zone.matrix_map->width = matrix_map[0].size();
keys_zone.matrix_map->height = matrix_map.size();
keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size();
keys_zone.matrix_map->height = (unsigned int)matrix_map.size();
keys_zone.matrix_map->map = flat_matrix_map.data();
zones.push_back(keys_zone);
@ -368,8 +368,8 @@ void RGBController_QMKOpenRGBRev9::SetupZones()
underglow_zone.leds_max = underglow_zone.leds_min;
underglow_zone.leds_count = underglow_zone.leds_min;
underglow_zone.matrix_map = new matrix_map_type;
underglow_zone.matrix_map->width = underglow_map[0].size();
underglow_zone.matrix_map->height = underglow_map.size();
underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size();
underglow_zone.matrix_map->height = (unsigned int)underglow_map.size();
underglow_zone.matrix_map->map = flat_underglow_map.data();
zones.push_back(underglow_zone);
}
@ -652,7 +652,7 @@ void RGBController_QMKOpenRGBRev9::CleanMatrixMaps
can_break = false;
can_break_udg = false;
for(int j = matrix_map[i].size() - 1; j --> 0; )
for(int j = (int)matrix_map[i].size() - 1; j --> 0; )
{
if(matrix_map[i][j] != NO_LED && width < (j + 1) && !can_break)
{
@ -688,15 +688,15 @@ void RGBController_QMKOpenRGBRev9::CleanMatrixMaps
}
}
unsigned int new_height = height - empty_rows.size();
unsigned int new_height = height - (unsigned int)empty_rows.size();
width = empty_col ? width - 1 : width;
width_udg = empty_col_udg && empty_col ? width_udg - 1 : width_udg;
LOG_DEBUG("[%s] Key LED Matrix: %ux%u", name.c_str(), width, new_height);
LOG_DEBUG("[%s] Underglow LED Matrix: %ux%u", name.c_str(), width_udg, new_height);
for(unsigned int i = empty_rows.size(); i --> 0; )
for(unsigned int i = (unsigned int)empty_rows.size(); i --> 0; )
{
matrix_map.erase(matrix_map.begin()+empty_rows[i]);
matrix_map.erase(matrix_map.begin() + empty_rows[i]);
}
for(unsigned int i = 0; i < new_height; i++)

View file

@ -330,7 +330,7 @@ void RGBController_QMKOpenRGBRevB::SetupZones()
VectorMatrix underglow_map;
PlaceLEDsInMaps(rows, columns, divisor, led_points, led_flags, matrix_map, underglow_map);
CleanMatrixMaps(matrix_map, underglow_map, rows.size(), has_underglow);
CleanMatrixMaps(matrix_map, underglow_map, (unsigned int)rows.size(), has_underglow);
/*---------------------------------------------------------*\
| These vectors are class members because if they go out of |
@ -350,8 +350,8 @@ void RGBController_QMKOpenRGBRevB::SetupZones()
keys_zone.leds_max = keys_zone.leds_min;
keys_zone.leds_count = keys_zone.leds_min;
keys_zone.matrix_map = new matrix_map_type;
keys_zone.matrix_map->width = matrix_map[0].size();
keys_zone.matrix_map->height = matrix_map.size();
keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size();
keys_zone.matrix_map->height = (unsigned int)matrix_map.size();
keys_zone.matrix_map->map = flat_matrix_map.data();
zones.push_back(keys_zone);
@ -367,8 +367,8 @@ void RGBController_QMKOpenRGBRevB::SetupZones()
underglow_zone.leds_max = underglow_zone.leds_min;
underglow_zone.leds_count = underglow_zone.leds_min;
underglow_zone.matrix_map = new matrix_map_type;
underglow_zone.matrix_map->width = underglow_map[0].size();
underglow_zone.matrix_map->height = underglow_map.size();
underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size();
underglow_zone.matrix_map->height = (unsigned int)underglow_map.size();
underglow_zone.matrix_map->map = flat_underglow_map.data();
zones.push_back(underglow_zone);
}
@ -693,7 +693,7 @@ void RGBController_QMKOpenRGBRevB::CleanMatrixMaps
can_break = false;
can_break_udg = false;
for(int j = matrix_map[i].size() - 1; j --> 0; )
for(int j = (int)matrix_map[i].size() - 1; j --> 0; )
{
if(matrix_map[i][j] != NO_LED && width < (j + 1) && !can_break)
{
@ -729,13 +729,13 @@ void RGBController_QMKOpenRGBRevB::CleanMatrixMaps
}
}
unsigned int new_height = height - empty_rows.size();
unsigned int new_height = height - (unsigned int)empty_rows.size();
width = empty_col ? width - 1 : width;
width_udg = empty_col_udg && empty_col ? width_udg - 1 : width_udg;
LOG_DEBUG("[%s] Key LED Matrix: %ux%u", name.c_str(), width, new_height);
LOG_DEBUG("[%s] Underglow LED Matrix: %ux%u", name.c_str(), width_udg, new_height);
for(unsigned int i = empty_rows.size(); i --> 0; )
for(unsigned int i = (unsigned int)empty_rows.size(); i --> 0; )
{
matrix_map.erase(matrix_map.begin()+empty_rows[i]);
}

View file

@ -78,14 +78,14 @@ void QMKOpenRGBRevDController::GetLEDInfo(unsigned int leds_count)
underglow_points.push_back(point_t{usb_buf[offset + QMK_OPENRGB_POINT_X_BYTE], usb_buf[offset + QMK_OPENRGB_POINT_Y_BYTE]});
underglow_flags.push_back(usb_buf[offset + QMK_OPENRGB_FLAG_BYTE]);
underglow_colors.push_back(ToRGBColor(usb_buf[offset + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[offset + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[offset + QMK_OPENRGB_B_COLOR_BYTE]));
underglow_values.push_back(underglow_values.size() + led_values.size());
underglow_values.push_back((unsigned int)(underglow_values.size() + led_values.size()));
}
else
{
led_points.push_back(point_t{usb_buf[offset + QMK_OPENRGB_POINT_X_BYTE], usb_buf[offset + QMK_OPENRGB_POINT_Y_BYTE]});
led_flags.push_back(usb_buf[offset + QMK_OPENRGB_FLAG_BYTE]);
led_colors.push_back(ToRGBColor(usb_buf[offset + QMK_OPENRGB_R_COLOR_BYTE], usb_buf[offset + QMK_OPENRGB_G_COLOR_BYTE], usb_buf[offset + QMK_OPENRGB_B_COLOR_BYTE]));
led_values.push_back(underglow_values.size() + led_values.size());
led_values.push_back((unsigned int)(underglow_values.size() + led_values.size()));
}
}
@ -103,7 +103,8 @@ void QMKOpenRGBRevDController::GetLEDInfo(unsigned int leds_count)
led_names.push_back(KEY_EN_UNUSED);
}
}
else if(usb_buf[offset + QMK_OPENRGB_FLAG_BYTE] & 2){
else if(usb_buf[offset + QMK_OPENRGB_FLAG_BYTE] & 2)
{
underglow_names.push_back("Underglow: " + std::to_string(underglow_names.size() + led_names.size()));
}
}

View file

@ -325,7 +325,7 @@ void RGBController_QMKOpenRGBRevD::SetupZones()
VectorMatrix underglow_map;
PlaceLEDsInMaps(rows, columns, divisor, led_points, led_flags, matrix_map, underglow_map);
CleanMatrixMaps(matrix_map, underglow_map, rows.size(), has_underglow);
CleanMatrixMaps(matrix_map, underglow_map, (unsigned int)rows.size(), has_underglow);
/*---------------------------------------------------------*\
| These vectors are class members because if they go out of |
@ -345,8 +345,8 @@ void RGBController_QMKOpenRGBRevD::SetupZones()
keys_zone.leds_max = keys_zone.leds_min;
keys_zone.leds_count = keys_zone.leds_min;
keys_zone.matrix_map = new matrix_map_type;
keys_zone.matrix_map->width = matrix_map[0].size();
keys_zone.matrix_map->height = matrix_map.size();
keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size();
keys_zone.matrix_map->height = (unsigned int)matrix_map.size();
keys_zone.matrix_map->map = flat_matrix_map.data();
zones.push_back(keys_zone);
@ -362,8 +362,8 @@ void RGBController_QMKOpenRGBRevD::SetupZones()
underglow_zone.leds_max = underglow_zone.leds_min;
underglow_zone.leds_count = underglow_zone.leds_min;
underglow_zone.matrix_map = new matrix_map_type;
underglow_zone.matrix_map->width = underglow_map[0].size();
underglow_zone.matrix_map->height = underglow_map.size();
underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size();
underglow_zone.matrix_map->height = (unsigned int)underglow_map.size();
underglow_zone.matrix_map->map = flat_underglow_map.data();
zones.push_back(underglow_zone);
}
@ -694,7 +694,7 @@ void RGBController_QMKOpenRGBRevD::CleanMatrixMaps
can_break = false;
can_break_udg = false;
for(int j = matrix_map[i].size() - 1; j --> 0; )
for(int j = (int)matrix_map[i].size() - 1; j --> 0; )
{
if(matrix_map[i][j] != NO_LED && width < (j + 1) && !can_break)
{
@ -730,13 +730,13 @@ void RGBController_QMKOpenRGBRevD::CleanMatrixMaps
}
}
unsigned int new_height = height - empty_rows.size();
unsigned int new_height = height - (unsigned int)empty_rows.size();
width = empty_col ? width - 1 : width;
width_udg = empty_col_udg && empty_col ? width_udg - 1 : width_udg;
LOG_DEBUG("[%s] Key LED Matrix: %ux%u", name.c_str(), width, new_height);
LOG_DEBUG("[%s] Underglow LED Matrix: %ux%u", name.c_str(), width_udg, new_height);
for(unsigned int i = empty_rows.size(); i --> 0; )
for(unsigned int i = (unsigned int)empty_rows.size(); i --> 0; )
{
matrix_map.erase(matrix_map.begin()+empty_rows[i]);
}

View file

@ -341,7 +341,7 @@ void RGBController_QMKOpenRGBRevE::SetupZones()
VectorMatrix underglow_map;
PlaceLEDsInMaps(rows, columns, divisor, led_points, led_flags, matrix_map, underglow_map);
CleanMatrixMaps(matrix_map, underglow_map, rows.size(), has_underglow);
CleanMatrixMaps(matrix_map, underglow_map, (unsigned int)rows.size(), has_underglow);
/*---------------------------------------------------------*\
| These vectors are class members because if they go out of |
@ -361,8 +361,8 @@ void RGBController_QMKOpenRGBRevE::SetupZones()
keys_zone.leds_max = keys_zone.leds_min;
keys_zone.leds_count = keys_zone.leds_min;
keys_zone.matrix_map = new matrix_map_type;
keys_zone.matrix_map->width = matrix_map[0].size();
keys_zone.matrix_map->height = matrix_map.size();
keys_zone.matrix_map->width = (unsigned int)matrix_map[0].size();
keys_zone.matrix_map->height = (unsigned int)matrix_map.size();
keys_zone.matrix_map->map = flat_matrix_map.data();
zones.push_back(keys_zone);
@ -378,8 +378,8 @@ void RGBController_QMKOpenRGBRevE::SetupZones()
underglow_zone.leds_max = underglow_zone.leds_min;
underglow_zone.leds_count = underglow_zone.leds_min;
underglow_zone.matrix_map = new matrix_map_type;
underglow_zone.matrix_map->width = underglow_map[0].size();
underglow_zone.matrix_map->height = underglow_map.size();
underglow_zone.matrix_map->width = (unsigned int)underglow_map[0].size();
underglow_zone.matrix_map->height = (unsigned int)underglow_map.size();
underglow_zone.matrix_map->map = flat_underglow_map.data();
zones.push_back(underglow_zone);
}
@ -710,7 +710,7 @@ void RGBController_QMKOpenRGBRevE::CleanMatrixMaps
can_break = false;
can_break_udg = false;
for(int j = matrix_map[i].size() - 1; j --> 0; )
for(int j = (int)matrix_map[i].size() - 1; j --> 0; )
{
if(matrix_map[i][j] != NO_LED && width < (j + 1) && !can_break)
{
@ -746,13 +746,13 @@ void RGBController_QMKOpenRGBRevE::CleanMatrixMaps
}
}
unsigned int new_height = height - empty_rows.size();
unsigned int new_height = height - (unsigned int)empty_rows.size();
width = empty_col ? width - 1 : width;
width_udg = empty_col_udg && empty_col ? width_udg - 1 : width_udg;
LOG_DEBUG("[%s] Key LED Matrix: %ux%u", name.c_str(), width, new_height);
LOG_DEBUG("[%s] Underglow LED Matrix: %ux%u", name.c_str(), width_udg, new_height);
for(unsigned int i = empty_rows.size(); i --> 0; )
for(unsigned int i = (unsigned int)empty_rows.size(); i --> 0; )
{
matrix_map.erase(matrix_map.begin()+empty_rows[i]);
}