Skip to content

Commit

Permalink
Implemented LIFX smartbulb bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roxas Keyheart committed Jul 7, 2018
1 parent 44d89bd commit 6609a16
Show file tree
Hide file tree
Showing 8 changed files with 214 additions and 108 deletions.
Binary file modified Build Dependencies/Sharlayan.dll
Binary file not shown.
27 changes: 14 additions & 13 deletions Chromatics/Chromatics.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Chromatics/Chromatics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,6 @@ private void CheckUpdates(int notify)
}

private delegate void BlinkDelegate();


}

public static class ExceptionExtensions
Expand Down
36 changes: 0 additions & 36 deletions Chromatics/Chromatics.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,6 @@
<metadata name="tooltip_main.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>685, 17</value>
</metadata>
<metadata name="tooltip_main.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>685, 17</value>
</metadata>
<metadata name="col_devicename.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_devicetype.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_state.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_mode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_dattype.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="col_devicename.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down Expand Up @@ -181,18 +157,6 @@ Important: This can prevent other apps from accessing LGS so make sure to disabl
<metadata name="mappings_col_color.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mappings_col_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mappings_col_cat.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mappings_col_type.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mappings_col_color.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mapping_colorEditorManager.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
Expand Down
2 changes: 1 addition & 1 deletion Chromatics/Controllers/FileOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private void LoadDevices()
}
}
}

private void SaveColorMappings(int report)
{
//if (report == 1)
Expand Down
46 changes: 44 additions & 2 deletions Chromatics/Controllers/GUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ private async void SetupDeviceDataGrid()
lifxdGDeviceDgc.DisplayStyle = DataGridViewComboBoxDisplayStyle.DropDownButton;

lifxdGDevice.Cells[dG_devices.Columns["col_mode"].Index] = lifxdGDeviceDgc;

//Check for duplicates

/*
Expand Down Expand Up @@ -681,10 +681,20 @@ private async void SetupDeviceDataGrid()
}
}

void dG_devices_CurrentCellDirtyStateChanged(object sender, EventArgs e)
{
if (this.dG_devices.IsCurrentCellDirty)
{
dG_devices.CommitEdit(DataGridViewDataErrorContexts.Commit);
}
}

private void dG_devices_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (DeviceGridStartup)
{
GlobalStopCycleEffects();

var editedCell = dG_devices.Rows[e.RowIndex].Cells[e.ColumnIndex];
var dattype = (string)dG_devices.Rows[e.RowIndex].Cells[dG_devices.Columns["col_dattype"].Index]
.Value;
Expand All @@ -707,7 +717,22 @@ private void dG_devices_CellValueChanged(object sender, DataGridViewCellEventArg
{
_lifx.LifxBulbsDat[bulb] = _lifx.LifxModeMemory[id];
_lifx.LifxStateMemory[bulb.MacAddressName] = 1;
WriteConsole(ConsoleTypes.Lifx, @"Enabled LIFX Bulb " + id);
WriteConsole(ConsoleTypes.Lifx, @"Enabled LIFX Bulb " + id + @" on mode " + _lifx.LifxModeMemory[id]);

switch (_lifx.LifxModeMemory[id])
{
case BulbModeTypes.Standby:
var state = _lifx.LifxBulbsRestore[bulb];
_lifx.SetColorAsync(bulb, state.Hue, state.Saturation, state.Brightness,
state.Kelvin,
TimeSpan.FromMilliseconds(1000));
WriteConsole(ConsoleTypes.Lifx, @"Restoring LIFX Bulb " + state.Label);
break;
case BulbModeTypes.DefaultColor:
case BulbModeTypes.HighlightColor:
SetKeysbase = false;
break;
}
}
else
{
Expand Down Expand Up @@ -769,7 +794,24 @@ private void dG_devices_CellValueChanged(object sender, DataGridViewCellEventArg
var bulb = _lifx.LifxDevices[id];
_lifx.LifxBulbsDat[bulb] = key;
_lifx.LifxModeMemory[bulb.MacAddressName] = key;

WriteConsole(ConsoleTypes.Lifx, @"Updated Mode of LIFX Bulb " + id + " to " + key);

switch (_lifx.LifxModeMemory[id])
{
case BulbModeTypes.Standby:
var state = _lifx.LifxBulbsRestore[bulb];
_lifx.SetColorAsync(bulb, state.Hue, state.Saturation, state.Brightness,
state.Kelvin,
TimeSpan.FromMilliseconds(1000));
WriteConsole(ConsoleTypes.Lifx, @"Restoring LIFX Bulb " + state.Label);
break;
case BulbModeTypes.DefaultColor:
case BulbModeTypes.HighlightColor:
SetKeysbase = false;
break;
}

}

if (HueSdkCalled == 1 && id != null && dattype == "HUE")
Expand Down
Loading

0 comments on commit 6609a16

Please sign in to comment.