mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-26 01:41:05 -04:00
Warning fixes and cleanups
This commit is contained in:
@@ -318,7 +318,7 @@ void RGBController_LenovoK510::ReadAndUpdateCurrentDeviceState()
|
||||
current_active_mode.direction = current_active_mode.direction ? MODE_DIRECTION_UP : MODE_DIRECTION_DOWN;
|
||||
}
|
||||
|
||||
active_mode = i;
|
||||
active_mode = (int)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,15 +286,15 @@ LenovoRGBController_Gen7_8::LenovoRGBController_Gen7_8(LenovoGen7And8USBControll
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------*\
|
||||
| Initiliaze Static |
|
||||
\*-----------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Initiliaze Static |
|
||||
\*-----------------------------------------------------*/
|
||||
active_mode = 0;
|
||||
for(size_t i = 0; i < modes.size(); i++)
|
||||
{
|
||||
if(modes[i].value == LENOVO_LEGION_GEN7_8_MODE_STATIC)
|
||||
{
|
||||
active_mode = i;
|
||||
active_mode = (int)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -307,7 +307,6 @@ LenovoRGBController_Gen7_8::~LenovoRGBController_Gen7_8()
|
||||
delete controller;
|
||||
}
|
||||
|
||||
|
||||
void LenovoRGBController_Gen7_8::SetupZones()
|
||||
{
|
||||
vector<lenovo_zone> lenovo_zones;
|
||||
@@ -363,9 +362,9 @@ void LenovoRGBController_Gen7_8::SetupZones()
|
||||
new_led.value = lenovo_zones[i].id << 8 | lenovo_zones[i].leds[led_idx].led_num ;
|
||||
leds.push_back(new_led);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| create led id to index map for fast look up |
|
||||
\*---------------------------------------------------------*/
|
||||
/*---------------------------------------------*\
|
||||
| create led id to index map for fast look up |
|
||||
\*---------------------------------------------*/
|
||||
led_id_to_index[new_led.value]=leds.size() - 1;
|
||||
}
|
||||
}
|
||||
@@ -449,9 +448,10 @@ void LenovoRGBController_Gen7_8::DeviceUpdateLEDs()
|
||||
{
|
||||
if(controller->getPid() == LEGION_7GEN10)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Gen10 may ignore A1 updates unless D0 is reasserted. |
|
||||
\*---------------------------------------------------------*/
|
||||
/*---------------------------------------------*\
|
||||
| Gen10 may ignore A1 updates unless D0 is |
|
||||
| reasserted. |
|
||||
\*---------------------------------------------*/
|
||||
controller->setLedsDirectOn(profile_id);
|
||||
direct_enabled = true;
|
||||
}
|
||||
@@ -585,9 +585,9 @@ std::vector<led_group> LenovoRGBController_Gen7_8::GetLedGroups()
|
||||
size_t start = 0;
|
||||
size_t end = leds.size();
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Riplle and Type only apply to keyboard |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-------------------------------------------------*\
|
||||
| Riplle and Type only apply to keyboard |
|
||||
\*-------------------------------------------------*/
|
||||
if(modes[active_mode].value == LENOVO_LEGION_GEN7_8_MODE_RIPPLE ||
|
||||
modes[active_mode].value == LENOVO_LEGION_GEN7_8_MODE_TYPE)
|
||||
{
|
||||
|
||||
@@ -321,7 +321,7 @@ void RGBController_LianLiUniHubSL::SetupZones()
|
||||
new_led.name = zones[zone_idx].name;
|
||||
new_led.name.append(", Fan ");
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
new_led.value = zone_idx;
|
||||
new_led.value = (unsigned int)zone_idx;
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
/*-------------------------------*\
|
||||
| TODO: Detect detached keypad |
|
||||
\*-------------------------------*/
|
||||
/*---------------------------------------------------------*\
|
||||
| TODO: Detect detached keypad |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
std::vector<unsigned int> mountain60_keyboard_key_id_values =
|
||||
{
|
||||
@@ -37,9 +37,9 @@ layout_values mountain60_layout =
|
||||
{
|
||||
mountain60_keyboard_key_id_values,
|
||||
{
|
||||
/*------------------------------------------*\
|
||||
| No regional layout fix for the moment |
|
||||
\*------------------------------------------*/
|
||||
/*---------------------------------------------*\
|
||||
| No regional layout fix for the moment |
|
||||
\*---------------------------------------------*/
|
||||
},
|
||||
};
|
||||
|
||||
@@ -348,9 +348,9 @@ RGBController_Mountain60Keyboard::~RGBController_Mountain60Keyboard()
|
||||
mountain_thread->join();
|
||||
delete mountain_thread;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Delete the matrix map |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
|
||||
{
|
||||
if(zones[zone_index].type == ZONE_TYPE_MATRIX)
|
||||
@@ -406,10 +406,10 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char* color_data = new unsigned char[(leds.size()*4)];
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Filling the color_data vector with progressive index |
|
||||
| leaving space for RGB data |
|
||||
\*---------------------------------------------------------*/
|
||||
/*-----------------------------------------------------*\
|
||||
| Filling the color_data vector with progressive index |
|
||||
| leaving space for RGB data |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
|
||||
{
|
||||
const unsigned int idx = led_idx * 4;
|
||||
@@ -419,7 +419,7 @@ void RGBController_Mountain60Keyboard::DeviceUpdateLEDs()
|
||||
color_data[idx + 3] = RGBGetBValue(colors[led_idx]);
|
||||
}
|
||||
|
||||
controller->SendDirect(modes[active_mode].brightness, color_data, (leds.size()*4));
|
||||
controller->SendDirect(modes[active_mode].brightness, color_data, ((unsigned int)leds.size() * 4));
|
||||
delete[] color_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
// Sources for define values:
|
||||
// - https://en.wikipedia.org/wiki/Serial_presence_detect
|
||||
// - JEDEC DDR5 Serial Presence Detect (SPD): Table of contents
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Sources for define values: |
|
||||
| - https://en.wikipedia.org/wiki/Serial_presence_detect |
|
||||
| - JEDEC DDR5 Serial Presence Detect (SPD): Table of |
|
||||
| contents |
|
||||
\*---------------------------------------------------------*/
|
||||
#define BASIC_MEMORY_TYPE_ADDR (0x02)
|
||||
|
||||
#define DDR4_JEDEC_ID_ADDR (0x140)
|
||||
@@ -121,17 +122,21 @@ std::string SPDAccessor::read_part_nr_at(uint16_t address, std::size_t len)
|
||||
part_number += (char)this->at(spd_addr);
|
||||
}
|
||||
|
||||
// Find the true end of string & truncate it to that point.
|
||||
// Part number should be padded with 0x20 (space) for DDR4 (Source: Wikipedia)
|
||||
// It may be padded with 0x00 (Source: real-life tests on DDR5 memory)
|
||||
// Note: To prevent infinite loop, end_of_string_idx MUST be signed.
|
||||
int end_of_string_idx = part_number.length()-1;
|
||||
/*-----------------------------------------------------*\
|
||||
| Find the true end of string and truncate it to that |
|
||||
| point. Part number should be padded with 0x20 |
|
||||
| (space) for DDR4 (Source: Wikipedia). |
|
||||
| It may be padded with 0x00 (Source: real-life tests |
|
||||
| on DDR5 memory). |
|
||||
| Note: To prevent infinite loop, end_of_string_idx |
|
||||
| MUST be signed. |
|
||||
\*-----------------------------------------------------*/
|
||||
std::size_t end_of_string_idx = part_number.length() - 1;
|
||||
|
||||
for(; end_of_string_idx >= 0; end_of_string_idx--)
|
||||
{
|
||||
if(
|
||||
part_number[end_of_string_idx] != '\0' &&
|
||||
part_number[end_of_string_idx] != ' '
|
||||
)
|
||||
if((part_number[end_of_string_idx] != '\0')
|
||||
&& (part_number[end_of_string_idx] != ' '))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -62,10 +62,12 @@ int startup(int argc, char* argv[], unsigned int ret_flags)
|
||||
LOG_TRACE("[main] initializing GUI");
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Enable high DPI scaling support |
|
||||
| Enable high DPI scaling support (Qt5 only) |
|
||||
\*-------------------------------------------------*/
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Enable high DPI fractional scaling support on |
|
||||
|
||||
Reference in New Issue
Block a user