Skip to content

Commit

Permalink
Reverted tmc graph spline to line and added opengl rendering
Browse files Browse the repository at this point in the history
Removed special TMC handling in axis cpr readout

May cause incorrect angle readouts with outdated firmwares
  • Loading branch information
Ultrawipf committed Apr 2, 2024
1 parent 433b5a7 commit 4d3c7ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 1 addition & 4 deletions axis_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,7 @@ def timer_cb(self):
self.send_command("axis","pos",self.axis)
else:
# cpr invalid. Request cpr
if(self.driver_id == 1 or self.driver_id == 2):
self.cpr=0xffff # TODO remove if axis reports right cpr
else:
self.send_command("axis","cpr",typechar='?')
self.send_command("axis","cpr",typechar='?')


def setCurrentScaler(self,x):
Expand Down
11 changes: 7 additions & 4 deletions tmc4671_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from base_ui import WidgetUI
from optionsdialog import OptionsDialog,OptionsDialogGroupBox

from PyQt6.QtCharts import QChart,QChartView,QSplineSeries,QValueAxis
from PyQt6.QtCharts import QChart,QChartView,QLineSeries,QValueAxis
from base_ui import CommunicationHandler

ext_notice = """External encoder forwards the encoder
Expand Down Expand Up @@ -74,28 +74,31 @@ def __init__(self, main=None, unique=0):

self.chart.addAxis(self.chartYaxis_Amps,Qt.AlignmentFlag.AlignLeft)

self.lines_Amps = QSplineSeries()
self.lines_Amps = QLineSeries()
self.lines_Amps.setName("Torque A")
self.lines_Amps.setUseOpenGL(True)

self.chart.addSeries(self.lines_Amps)
self.lines_Amps.setColor(QColor("cornflowerblue"))
self.lines_Amps.attachAxis(self.chartYaxis_Amps)
self.lines_Amps.attachAxis(self.chartXaxis)

self.lines_Flux = QSplineSeries()
self.lines_Flux = QLineSeries()
self.lines_Flux.setName("Flux A")
self.lines_Flux.setOpacity(0.5)
self.lines_Flux.setUseOpenGL(True)

self.chart.addSeries(self.lines_Flux)
self.lines_Flux.setColor(QColor("limegreen"))

self.lines_Flux.attachAxis(self.chartYaxis_Amps)
self.lines_Flux.attachAxis(self.chartXaxis)

self.lines_Temps = QSplineSeries()
self.lines_Temps = QLineSeries()
self.lines_Temps.setName("Temp °C")
self.lines_Temps.setColor(QColor("orange"))
self.lines_Temps.setOpacity(0.5)
self.lines_Temps.setUseOpenGL(True)
self.chart.addAxis(self.chartYaxis_Temps,Qt.AlignmentFlag.AlignRight)
self.chart.addSeries(self.lines_Temps)
self.lines_Temps.attachAxis(self.chartYaxis_Temps)
Expand Down

0 comments on commit 4d3c7ad

Please sign in to comment.