Skip to content

Commit

Permalink
v2,v3,v8 fixes, 4800 and 3200 fixes, timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Troll committed Sep 15, 2024
1 parent b1dd418 commit 0711efa
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 36 deletions.
26 changes: 12 additions & 14 deletions AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace AlienFX_SDK {
case API_V8:
if (needV8Feature) {
res = HidD_SetFeature(devHandle, buffer, length);
Sleep(7);
Sleep(8);
}
else
{
Expand All @@ -117,7 +117,7 @@ namespace AlienFX_SDK {
return res;
}

bool Functions::SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse) {
void Functions::SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse) {
vector<Afx_icommand> mods;
PrepareAndSend(COMMV1_saveGroup, { {2, {blID}} });
if (act->act.size() < 2)
Expand All @@ -133,19 +133,20 @@ namespace AlienFX_SDK {
PrepareAndSend(COMMV1_color, SetMaskAndColor(&mods, ~((1 << act->index)), act->act.front(), act->act.back()));
PrepareAndSend(COMMV1_saveGroup, { {2, {blID}} });
PrepareAndSend(COMMV1_loop);
chain++;
chain++;
}

if (needSave) {
PrepareAndSend(COMMV1_save);
Reset();
}

return true;
//return true;
}

bool Functions::AlienFXProbeDevice(void* hDevInfo, void* devData, WORD vidd, WORD pidd) {
DWORD dwRequiredSize = 0;
COMMTIMEOUTS timeouts = {100,0,0,10,0};
version = API_UNKNOWN;
SetupDiGetDeviceInterfaceDetail(hDevInfo, (PSP_DEVICE_INTERFACE_DATA)devData, NULL, 0, &dwRequiredSize, NULL);
SP_DEVICE_INTERFACE_DETAIL_DATA* deviceInterfaceDetailData = (SP_DEVICE_INTERFACE_DETAIL_DATA*)new byte[dwRequiredSize];
Expand Down Expand Up @@ -217,6 +218,7 @@ chain++;
if (HidD_GetProductString(devHandle, descbuf, 255))
for (int i = 0; i < wcslen(descbuf); i++)
description += descbuf[i];
SetCommTimeouts(devHandle, &timeouts);
}
//DebugPrint("Probe done, type " + to_string(version) + "\n");
}
Expand Down Expand Up @@ -333,7 +335,7 @@ chain++;
mods->push_back( {bPos, {act->index,v8OpCodes[act->act.front().type], act->act.front().tempo, 0xa5, act->act.front().time, 0xa,
act->act.front().r, act->act.front().g,act->act.front().b,
act->act.back().r,act->act.back().g,act->act.back().b,
(byte)(act->act.size() > 1 ? 2 : 1)} } );
/*(byte)(act->act.size() > 1 ?*/ 2 /*: 1)*/} } );
}

void Functions::AddV5DataBlock(byte bPos, vector<Afx_icommand>* mods, byte index, Afx_action* c) {
Expand Down Expand Up @@ -623,15 +625,13 @@ chain++;
else
pwr = &(*ca);
if (pwr) {
if (act->size() > 1)
PrepareAndSend(COMMV1_save);
chain = 1;
if (save) {
// 08 02 - AC standby
Afx_lightblock tact{ pwr->index,
{{AlienFX_A_Morph, 0 , 0, pwr->act.front().r, pwr->act.front().g, pwr->act.front().b}, {2}} };
/*SavePowerBlock(2, tact, false);*/
//tact = {pwr->index,
// {{AlienFX_A_Morph, 0 , 0, 0, 0, 0},
// {2,0,0,pwr->act.back().r, pwr->act.back().g, pwr->act.back().b}}};
SavePowerBlock(2, &tact, true, true);
// 08 05 - AC power
tact = { pwr->index,
Expand All @@ -657,13 +657,11 @@ chain++;
tact.act.front().type = AlienFX_A_Pulse;
SavePowerBlock(9, &tact, true);
}
//int pind = powerMode ? 0 : 1;
//SetColor(pwr->index, { pwr->act[pind].b, pwr->act[pind].g, pwr->act[pind].r });
}
if (act->size())
PrepareAndSend(COMMV1_save);
if (pwr)
SetAction(pwr);
} else
if (act->size())
PrepareAndSend(COMMV1_save);
} break;
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion AlienFX-SDK/AlienFX_SDK/AlienFX_SDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace AlienFX_SDK {
inline void AddV5DataBlock(byte bPos, vector<Afx_icommand>* mods, byte index, Afx_action* act);

// Support function to send whole power block for v1-v3
bool SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse = false);
void SavePowerBlock(byte blID, Afx_lightblock* act, bool needSave, bool needInverse = false);

// Support function for APIv4 action set
bool SetV4Action(Afx_lightblock* act);
Expand Down
14 changes: 7 additions & 7 deletions Install/Install.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -557,15 +557,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:AlienFX Tools"
"ProductCode" = "8:{D02D3A00-BCAE-4B1E-9D8F-96B81AD344D7}"
"PackageCode" = "8:{532592B2-AAA4-43D5-A1AF-3E7403B38BF4}"
"ProductCode" = "8:{47BFA81E-BBBD-4D16-ACE4-0CCEAF04689B}"
"PackageCode" = "8:{49A55259-EE42-4904-8BDD-8A2218349007}"
"UpgradeCode" = "8:{EFC2D182-AE5E-4585-92D3-0759F77F59AA}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:FALSE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:9.0.1"
"ProductVersion" = "8:9.0.2"
"Manufacturer" = "8:T-Troll"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://github.com/T-Troll/alienfx-tools/discussions"
Expand Down Expand Up @@ -925,7 +925,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_1924518F6EA84AD696BCCE8E589E25C7"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfx-gui.exe"
"SourcePath" = "8:..\\x64\\Release\\alienfx-gui.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -953,7 +953,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_4B7975803E6C492C8F7D8B599766674C"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfan-gui.exe"
"SourcePath" = "8:..\\x64\\Release\\alienfan-gui.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1009,7 +1009,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_B829425435A04EFB81D071102204D8B4"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfan-cli.exe"
"SourcePath" = "8:..\\x64\\Release\\alienfan-cli.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down Expand Up @@ -1093,7 +1093,7 @@
}
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FA7989C51ECD437AB3316446FB849F60"
{
"SourcePath" = "8:..\\x64\\Release_V1\\alienfx-mon.exe"
"SourcePath" = "8:..\\x64\\Release\\alienfx-mon.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_77CCC7F3944A4B009D9231F8B41DFD6D"
Expand Down
8 changes: 4 additions & 4 deletions LightFX/LightFX.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 9,0,0,1
PRODUCTVERSION 9,0,0,1
FILEVERSION 9,0,0,2
PRODUCTVERSION 9,0,0,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -78,12 +78,12 @@ BEGIN
BLOCK "040004b0"
BEGIN
VALUE "FileDescription", "LightFX emulator"
VALUE "FileVersion", "9.0.0.1"
VALUE "FileVersion", "9.0.0.2"
VALUE "InternalName", "LightFX.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "LightFX.dll"
VALUE "ProductName", "AlienFX Tools"
VALUE "ProductVersion", "9.0.0.1"
VALUE "ProductVersion", "9.0.0.2"
END
END
BLOCK "VarFileInfo"
Expand Down
Binary file modified alienfan-tools/alienfan-gui/alienfan-gui.rc
Binary file not shown.
3 changes: 2 additions & 1 deletion alienfan-tools/alienfan-mon/MonHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void MonHelper::SetCurrentMode(int newMode) {
newMode = fan_conf->lastProf->gmodeStage ? powerSize : fan_conf->lastProf->powerStage;
//int cmode = GetPowerMode();
if (newMode != powerMode) {
acpi->SetPower(0xa0);
if (newMode < powerSize) {
if (powerMode == powerSize) {
acpi->SetGMode(0);
Expand All @@ -86,7 +87,7 @@ void MonHelper::SetCurrentMode(int newMode) {
DebugPrint("Mon: Power mode switch from " + (powerMode == powerSize ? "G-mode" : to_string(powerMode)) + " to " + to_string(newMode) + "\n");
}
else {
acpi->SetPower(0xa0);
//acpi->SetPower(0xa0);
acpi->SetGMode(1);
DebugPrint("Mon: Power mode switch from " + to_string(powerMode) + " to G-mode\n");
}
Expand Down
21 changes: 12 additions & 9 deletions alienfx-cli/alienfx-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ AlienFX_SDK::Afx_colorcode Act2Code(AlienFX_SDK::Afx_action* act) {
}

LFX_COLOR Act2Lfx(AlienFX_SDK::Afx_action* act) {
return { act->r,act->g,act->b, 255 };
return { act->r,act->g,act->b, globalBright };
}

vector<AlienFX_SDK::Afx_action> ParseActions(vector<ARG>* args, int startPos) {
Expand All @@ -92,11 +92,14 @@ vector<AlienFX_SDK::Afx_action> ParseActions(vector<ARG>* args, int startPos) {
argPos++;
}
actions.push_back({ acttype, sleepy, longer,
(byte)args->at(argPos).num, (byte)args->at(argPos + 1).num, (byte)args->at(argPos + 2).num });
AlienFX_SDK::Afx_action* color = &actions.back();
color->r = ((unsigned)color->r * globalBright) / 255;// >> 8;
color->g = ((unsigned)color->g * globalBright) / 255;// >> 8;
color->b = ((unsigned)color->b * globalBright) / 255;// >> 8;
(byte)((args->at(argPos).num * globalBright) / 255), //r
(byte)((args->at(argPos + 1).num * globalBright) / 255), //g
(byte)((args->at(argPos + 2).num * globalBright) / 255) //b
});
//AlienFX_SDK::Afx_action* color = &actions.back();
//color->r = ((unsigned)color->r * globalBright) / 255;// >> 8;
//color->g = ((unsigned)color->g * globalBright) / 255;// >> 8;
//color->b = ((unsigned)color->b * globalBright) / 255;// >> 8;
}
if (actions.size() < 2 && actions.front().type != (devType ? AlienFX_SDK::Action::AlienFX_A_Color : LFX_ACTION_COLOR))
actions.push_back({ actions.front().type, (BYTE)sleepy, longer, 0, 0, 0 });
Expand All @@ -105,7 +108,7 @@ vector<AlienFX_SDK::Afx_action> ParseActions(vector<ARG>* args, int startPos) {

int main(int argc, char* argv[])
{
printf("alienfx-cli v8.6.1.1\n");
printf("alienfx-cli v9.0.0.2\n");
if (argc < 2)
{
printUsage();
Expand Down Expand Up @@ -268,7 +271,7 @@ int main(int argc, char* argv[])
// low-level
if (afx_map.fxdevs.size()) {
devType = 1;
printf("Device access selected\n");
printf("USB Device selected\n");
}
break;
case COMMANDS::highlevel:
Expand Down Expand Up @@ -387,7 +390,7 @@ int main(int argc, char* argv[])
}
printf("Done.");
} else
printf("Both low-level and high-level devices not found, exiting!\n");
printf("Light devices not found, exiting!\n");

if (have_high)
lfxUtil.Release();
Expand Down
Binary file modified alienfx-gui/alienfx-gui.rc
Binary file not shown.
Binary file modified alienfx-mon/alienfx-mon.rc
Binary file not shown.

0 comments on commit 0711efa

Please sign in to comment.