Skip to content

Commit 263f7ed

Browse files
committed
0.99
1 parent b3f7450 commit 263f7ed

11 files changed

Lines changed: 56 additions & 178 deletions

File tree

.gitignore

Lines changed: 3 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,4 @@
1-
# project
2-
misc/
3-
dist/pygrid/
4-
notes.txt
5-
pygrid.json
6-
gitconf.bat
7-
gitcommit.bat
8-
9-
10-
#vscode
11-
.vscode/
12-
13-
# Byte-compiled / optimized / DLL files
141
__pycache__/
15-
*.py[cod]
16-
*$py.class
17-
18-
# C extensions
19-
*.so
20-
21-
# Distribution / packaging
22-
.Python
23-
env/
24-
build/
25-
develop-eggs/
26-
#dist/
27-
downloads/
28-
eggs/
29-
.eggs/
30-
lib/
31-
lib64/
32-
parts/
33-
sdist/
34-
var/
35-
wheels/
36-
*.egg-info/
37-
.installed.cfg
38-
*.egg
39-
40-
# PyInstaller
41-
# Usually these files are written by a python script from a template
42-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
43-
*.manifest
44-
*.spec
45-
46-
# Installer logs
47-
pip-log.txt
48-
pip-delete-this-directory.txt
49-
50-
# Unit test / coverage reports
51-
htmlcov/
52-
.tox/
53-
.coverage
54-
.coverage.*
55-
.cache
56-
nosetests.xml
57-
coverage.xml
58-
*.cover
59-
.hypothesis/
60-
61-
# Translations
62-
*.mo
63-
*.pot
64-
65-
# Django stuff:
66-
*.log
67-
local_settings.py
68-
69-
# Flask stuff:
70-
instance/
71-
.webassets-cache
72-
73-
# Scrapy stuff:
74-
.scrapy
75-
76-
# Sphinx documentation
77-
docs/_build/
78-
79-
# PyBuilder
80-
target/
81-
82-
# Jupyter Notebook
83-
.ipynb_checkpoints
84-
85-
# pyenv
86-
.python-version
87-
88-
# celery beat schedule file
89-
celerybeat-schedule
90-
91-
# SageMath parsed files
92-
*.sage.py
93-
94-
# dotenv
95-
.env
96-
97-
# virtualenv
98-
.venv
99-
venv/
100-
ENV/
101-
102-
# Spyder project settings
103-
.spyderproject
104-
.spyproject
105-
106-
# Rope project settings
107-
.ropeproject
108-
109-
# mkdocs documentation
110-
/site
111-
112-
# mypy
113-
.mypy_cache/
2+
.idea/
3+
dist/
4+
pygrid.json

_run.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

build.bat

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
echo off
2+
3+
rmdir /q /s dist
4+
rmdir /q /s build
5+
6+
pyinstaller -w --icon ui\img\icon.ico pygrid.py
7+
8+
cd dist
9+
"C:\Program Files\7-Zip\7z.exe" a pygrid.zip pygrid
10+
11+
rmdir /q /s pygrid
12+
cd ..
13+
rmdir /q /s build
14+
del /q pygrid.spec

controller.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313

1414
class Controller(QThread):
15-
"""Polls data from Hardware Monitor and Grid, applies control policy to fans, emits update signal to UI."""
15+
"""Polls data from Libre Hardware Monitor and Grid, applies control policy to fans, emits update signal to UI."""
1616
ok = True
1717
errorMessage = ""
1818
appsettings = None
1919
settingsTS = datetime.datetime(year=1900, month=1, day=1) # current timestamp of settings
20-
20+
2121
current_fan_speed = [] # holds latest uploaded fan speeds. Init to -1 to ensure first write-through
2222
new_fan_speed = [] # if new values are same as current, no updates are sent to Grid
2323
movingaverage = []
@@ -67,15 +67,15 @@ def run(self):
6767
td.now()
6868
remaining = TIME_SLICE - td.ms
6969
if (remaining > MAX_SLEEP): remaining = MAX_SLEEP
70-
if (remaining > 0):
70+
if (remaining > 0):
7171
time.sleep(remaining / 1000.0)
7272
sleep_count += 1
7373

7474
td.now()
7575
slice_time = td.ms
7676
#print ("loop={0}, exec={1}, slice={2}, sleep count={3}".format(counter, exec_time, slice_time, sleep_count))
7777
counter += 1
78-
78+
7979
self.grid.close()
8080
self.hamon.close()
8181
print ("Controller has stopped")
@@ -131,12 +131,12 @@ def dowork(self):
131131
# save the timestamp of newest settings to track further changes
132132
self.settingsTS = self.appsettings.timestamp
133133

134-
# get recent readings from hardware monitor and apply control policy
134+
# get recent readings from Libre Hardware Monitor and apply control policy
135135
self.hamon.update()
136136
if self.hamon.ok:
137137
self.hamon.updateSignals(self.signals)
138138

139-
if (self.hamon.ok and self.grid.ok):
139+
if (self.hamon.ok and self.grid.ok):
140140
self.control()
141141

142142
# pack data into a dict for visualization, emit signal to UI
@@ -149,7 +149,7 @@ def dowork(self):
149149
"fans": fans, "fanspeed": self.current_fan_speed[1:NFANS+1]
150150
}
151151
self.uiUpdate.emit(signalData)
152-
152+
153153

154154
def control(self):
155155
"""Loops through all fans, applies control policy to each, sends updates to Grid"""
@@ -208,7 +208,7 @@ def control_fan(self, fanindex, policy):
208208

209209
tempA, speedA = (temp, 0) # zero default speed if the curve is empty
210210
tempB, speedB = (temp, 0)
211-
211+
212212
# find two points on the curve to the left and to the right of the current temp
213213
for i in range(0, len(curve)):
214214
c = curve[i]

dist/pygrid.zip

-34.3 MB
Binary file not shown.

hardware.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class NZXTGrid():
2222
# Get fan voltage: 84 XX -> C0 00 00 NN NN
2323
# Get fan amperage: 85 XX -> C0 00 00 NN NN
2424
# Get fan RPM: 8A XX -> C0 00 00 RR RR
25-
#
25+
#
2626
# Parameters:
2727
# XX: fan ID (01, 02, 03, 04, 05, 06)
2828
# NN NN: volts/amperes (07 50: 7.80V, 02 12: 2.18 amps)
@@ -66,7 +66,7 @@ def open(self, port):
6666
self._err("Could not open port {0}. Access denied. The port may be in use by another application.".format(port))
6767
else:
6868
self._err(str(e))
69-
69+
7070

7171
def close(self):
7272
if (not self.com.closed):
@@ -79,7 +79,7 @@ def _err(self, errtext):
7979
print (errtext)
8080
self.ok = False
8181
self.errorCount += 1
82-
82+
8383

8484
def _cmd(self, data, response_length=1):
8585
"""Sends an arbitrary command to Grid and returns a response"""
@@ -180,7 +180,7 @@ def poll(self, pollrpm=True, pollvoltage=True, pollamperage=True):
180180
# http://timgolden.me.uk/python/wmi/cookbook.html
181181

182182
class Hamon():
183-
"""Provides WMI interface to Hardware Monitor and its temperature readings"""
183+
"""Provides WMI interface to Libre Hardware Monitor and its temperature readings"""
184184
ok = True
185185
errorMessage = ""
186186
initialized = False
@@ -191,10 +191,10 @@ class Hamon():
191191
def __init__(self):
192192
try:
193193
CoInitialize()
194-
self.hamon = wmi.WMI(namespace="root\OpenHardwareMonitor")
194+
self.hamon = wmi.WMI(namespace="root\LibreHardwareMonitor")
195195
self.initialized = True
196196
except Exception as e:
197-
self._err ("Error: Hardware monitor not installed.\nPlease install Hardware Monitor and restart the application.")
197+
self._err ("Error: Libre Hardware Monitor not installed.\nPlease install it and restart the application.")
198198

199199

200200
def _err(self, errtext):
@@ -206,7 +206,7 @@ def _err(self, errtext):
206206
def update(self):
207207
# run only if initialization was successful
208208
if (self.initialized):
209-
# it is possible that at boot time Hardware Monitor starts later than the app,
209+
# it is possible that at boot time Libre Hardware Monitor starts later than the app,
210210
# so the sensor readings will not be available immediately - we need to retry until the monitor is loaded.
211211
self.ok = True # reset error
212212

@@ -251,9 +251,9 @@ def updateSignals(self, signals):
251251
s.update(val)
252252
totalsum += val
253253

254-
# if no readings were found assume Hardware Monitor is not (yet) running
254+
# if no readings were found assume Libre Hardware Monitor is not (yet) running
255255
if (totalsum == 0):
256-
self._err("The data from Hardware Monitor is unavailable.\nCheck if Monitor is started.")
256+
self._err("The data from Libre Hardware Monitor is unavailable.\nPlease check if it is running.")
257257

258258

259259
def getSignalValue(self, fn, sensors):
@@ -273,7 +273,7 @@ def getSignalValue(self, fn, sensors):
273273
if (val > max): max = val
274274
avg += val
275275
count += 1
276-
276+
277277
res = max
278278
if (fn == "avg"): res = avg / float(count)
279279
return res

pygrid.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from util import StrStream
1616

1717

18-
APP_TITLE = "PyGrid 0.98"
18+
APP_TITLE = "PyGrid 0.99"
1919

2020

2121
class MainWindow(QMainWindow):
@@ -65,7 +65,7 @@ def __init__(self, app):
6565
self.controller.uiUpdate.connect(self.update)
6666

6767
startminimized = False
68-
if (self.appsettings.ok):
68+
if (self.appsettings.ok):
6969
startminimized = self.appsettings.settings["app"]["startminimized"]
7070
self.controller.start()
7171
else:
@@ -77,11 +77,11 @@ def __init__(self, app):
7777
print(self.appsettings.errorMessage)
7878
self.ui.statusEdit.setStyleSheet(self.COLOR_ERR)
7979
self.ui.statusEdit.setPlainText(x.data)
80-
81-
if (not startminimized):
80+
81+
if (not startminimized):
8282
self.show()
8383
self.controller.enableUICallbacks = True
84-
84+
8585

8686
def keyPressClosure(self, uiControl):
8787
"""Wraps event with a closure to avoid subclassing PlainTextEdit"""
@@ -207,7 +207,7 @@ def update(self, data):
207207
if (portsandsensors and self.appsettings.gridstats):
208208
print("\nGrid reads: {0}, writes: {1}, errors: {2}".format(
209209
self.controller.grid.readCount,
210-
self.controller.grid.writeCount,
210+
self.controller.grid.writeCount,
211211
self.controller.grid.errorCount))
212212
else:
213213
self.ui.statusEdit.setStyleSheet(self.COLOR_ERR)

readme.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# PyGrid
2-
PyGrid allows to control fan speeds using [NZXT Grid+ V2](https://www.nzxt.com/products/grid-plus-v2) device. PyGrid is a simple and stable alternative to NZXT CAM software when it comes to fan control.
2+
PyGrid allows you to control fan speeds using an [NZXT Grid+ V2](https://www.nzxt.com/products/grid-plus-v2). PyGrid is a simple and stable alternative to NZXT CAM software when it comes to fan control.
33

4-
<img src="https://github.com/andyatgh/pygrid/blob/master/screenshots/pygrid1.png">
5-
<img src="https://github.com/andyatgh/pygrid/blob/master/screenshots/pygrid2.png" width="320">
4+
<img src="https://github.com/nicegamer7/pygrid/blob/master/screenshots/pygrid1.png">
5+
<img src="https://github.com/nicegamer7/pygrid/blob/master/screenshots/pygrid2.png" width="320">
66

77
## PyGrid key features
88
* Very simple interface, all settings are edited as text.
@@ -11,12 +11,12 @@ PyGrid allows to control fan speeds using [NZXT Grid+ V2](https://www.nzxt.com/p
1111
* Rich customization of temperature signals and fan curves allows lots of flexibility in fan control.
1212

1313
## Installation
14-
1. Download and launch [Open Hardware Monitor](http://openhardwaremonitor.org/downloads/). Make sure it starts with Windows. PyGrid uses temperature data from OHM.
15-
2. Download [PyGrid executable](https://github.com/andyatgh/pygrid/tree/master/dist) and launch it from any folder. The app will open and register itself for startup with Windows.
14+
1. PyGrid uses temperature data from Libre Hardware Monitor. Download and launch [Libre Hardware Monitor](https://ci.appveyor.com/project/LibreHardwareMonitor/librehardwaremonitor/build/artifacts). Make sure it starts with Windows.
15+
2. Download [PyGrid](https://github.com/nicegamer7/pygrid/releases) and launch it from any folder. The app will open and register itself for startup with Windows.
1616
3. PyGrid will initialize the settings and create default fan curves for all fans - edit them in the Settings panel, setup other parameters the way you think is best for your system, hit Ctrl+Enter, settings will be saved and applied immediately.
1717

18-
<img src="https://github.com/andyatgh/pygrid/blob/master/screenshots/hamon1.png" width="320">
19-
<img src="https://github.com/andyatgh/pygrid/blob/master/screenshots/pygrid3.png" width="320">
18+
<img src="https://github.com/nicegamer7/pygrid/blob/master/screenshots/hamon1.png" width="320">
19+
<img src="https://github.com/nicegamer7/pygrid/blob/master/screenshots/pygrid3.png" width="320">
2020

2121

2222
## PyGrid settings
@@ -99,13 +99,12 @@ The app itself is stable but I noticed two minor issues with the Grid hardware i
9999
* Very rarely the controller may not execute the command given to it (setting fan speed may fail or data polling may not return voltage, rpm or amperage). It may stop responding for a few seconds and then come back to life. This will be properly handled by PyGrid which will reconnect to the device, but a brief warning message may be displayed in the Status panel.
100100

101101
## Build
102-
The code works with Python 3.6 and 3.5. The executable was built with Pyinstaller 3.3 using Python 3.6. The basic dependencies were part of Anaconda distribution. The corresponding batch files for installing additional dependencies and building the executable are supplied with the source code. Pyinstaller 3.3 has some issues handling PyQT dependencies, so one DLL had to be copied over to the dist directory in order for the app to start - this is done in the batch file as part of the build process.
103-
102+
PyGrid is compatible with Python 3.5, 3.6, and 3.7. The required dependencies are listed in the dependencies.txt file. After those packages are installed, it is as simple as running the build.bat file.
104103

105104
## Acknowledgements
106105
I would like to thank [akej74](https://github.com/akej74) and [RoelGo](https://github.com/RoelGo) for the awesome work they did in the similar projects and whose source code helped me understand the way Grid operates. Project references:
107106
* [Grid Control](https://github.com/akej74/grid-control) by [akej74](https://github.com/akej74)
108107
* [CamSucks](https://github.com/RoelGo/CamSucks) by [RoelGo](https://github.com/RoelGo)
109108

110-
#
111-
<img src="https://github.com/andyatgh/pygrid/blob/master/ui/img/icon.png" width="96">
109+
#
110+
<img src="https://github.com/nicegamer7/pygrid/blob/master/ui/img/icon.png" width="96">

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PyInstaller
2+
pyqt5-stubs
3+
pyserial
4+
pywin32
5+
WMI

z-build.bat

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)