From 4678656e0faf10e3b8085ba1c9937125fdb9d937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elena=20Arensk=C3=B6tter?= Date: Sat, 4 Nov 2023 13:51:51 +0100 Subject: [PATCH] Work on client --- src/MAX11270.py | 2 +- src/MCP3204.py | 5 +---- src/server.py | 2 +- src/spithread.py | 3 ++- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/MAX11270.py b/src/MAX11270.py index 14b39bb..0d170d7 100644 --- a/src/MAX11270.py +++ b/src/MAX11270.py @@ -229,7 +229,7 @@ class MAX11270: # Set chip select high to end the read process GPIO.output(self.csPin, GPIO.HIGH) - print(bin(retVal)) + #print(bin(retVal)) return retVal def _spi_write(self,adc_command): diff --git a/src/MCP3204.py b/src/MCP3204.py index 72df4ae..0d065c8 100644 --- a/src/MCP3204.py +++ b/src/MCP3204.py @@ -59,11 +59,8 @@ class MCP3204(): # Read 1 data bit if GPIO.input(self.misoPin): - retVal |= 0x1 + retVal |= (1<<(7-bit)) - # Advance input to next bit - retVal <<= 1 - self._toggleClock() ret.append(retVal) # get the 24b out of the return diff --git a/src/server.py b/src/server.py index e8de77e..44199fa 100644 --- a/src/server.py +++ b/src/server.py @@ -10,7 +10,7 @@ import pin as GPIO GPIO.config('./config.json') import MAX11270 as adc -import mcp4822 as dac +import MCP4822 as dac import PID as pid import tcptools as TCP import spithread as SPIThread diff --git a/src/spithread.py b/src/spithread.py index 1776d42..2a8ddf4 100644 --- a/src/spithread.py +++ b/src/spithread.py @@ -89,7 +89,8 @@ def spithread(adc, dac): if msg[1] <= 1: if msg[2] <= 1: if msg[2] == 1: - voltage = float(msg[4]) - dac[msg[1]].nullVoltage + #voltage = float(msg[4]) - dac[msg[1]].nullVoltage + voltage = float(msg[4]) #- dac[msg[1]].nullVoltage T = dac[msg[1]].write(voltage,msg[2]) else: T = dac[msg[1]].write(float(msg[4]),msg[2])