Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quisk patch for Hardrock-50 HF power reading with Hermes-Lite 2
diff -u a/hermes/quisk_widgets.py b/hermes/quisk_widgets.py
--- a/hermes/quisk_widgets.py 2017-11-09 10:36:54.709441866 +0100
+++ b/hermes/quisk_widgets.py 2017-12-25 18:06:55.172739588 +0100
@@ -7,6 +7,12 @@
import wx
+# 3v3 rail measured with voltmeter
+volt3v3 = 3.256
+
+# voltage for 50W measurement
+pwr_ref = 2.15
+
class BottomWidgets: # Add extra widgets to the bottom of the screen
def __init__(self, app, hardware, conf, frame, gbs, vertBox):
self.config = conf
@@ -85,11 +91,19 @@
current = " Ampl %4d ma" % (1000*current)
self.text_pa_current.SetLabel(current)
fwd = self.hardware.hermes_fwd_power
+ fwd = 50.0 * (volt3v3 * (fwd/4096.0) / pwr_ref)**2
fwd = " %3.1f watts" % float(fwd)
self.text_fwd_power.SetLabel(fwd)
rev = self.hardware.hermes_rev_power
- swr = 1.2
- swr = " SWR %3.1f" % swr
+ if self.hardware.hermes_fwd_power > 0:
+ gamma = float(self.hardware.hermes_rev_power) / float(self.hardware.hermes_fwd_power)
+ if gamma < 1.0:
+ swr = (1.0 + gamma)/(1.0 - gamma)
+ swr = " SWR %3.1f" % swr
+ else:
+ swr = ""
+ else:
+ swr = ""
self.text_swr.SetLabel(swr)
def OnTextDataMenu(self, event):
btn = event.GetEventObject()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment