Enabled in
This commit is contained in:
6
.idea/workspace.xml
generated
6
.idea/workspace.xml
generated
@@ -2,7 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="72cc40b1-c3bf-43e3-bbc5-daa6555ea73d" name="Default Changelist" comment="">
|
<list default="true" id="72cc40b1-c3bf-43e3-bbc5-daa6555ea73d" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/kx.py" beforeDir="false" afterPath="$PROJECT_DIR$/kx.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/kx.py" beforeDir="false" afterPath="$PROJECT_DIR$/kx.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
@@ -26,13 +25,13 @@
|
|||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showExcludedFiles" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../texas_test" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Python.main">
|
<component name="RunManager" selected="Python.main">
|
||||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
<configuration name="main" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
@@ -84,6 +83,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="SvnConfiguration">
|
<component name="SvnConfiguration">
|
||||||
<configuration />
|
<configuration />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
28
kx.py
28
kx.py
@@ -48,9 +48,8 @@ class KX:
|
|||||||
|
|
||||||
|
|
||||||
def writeToFlashK(self):
|
def writeToFlashK(self):
|
||||||
msg = protocol_kx.CANMsgK(self.sbl_id, 0, protocol_kx.KX_FLAG_WRITE_REQ, K)
|
|
||||||
messageK = can.Message(arbitration_id=0x2BB, data=[self.sbl_id, 0, 0,
|
messageK = can.Message(arbitration_id=0x2BB, data=[self.sbl_id, 0, 0,
|
||||||
protocol_kx.KX_FLAG_WRITE_REQ], is_extended_id=False)
|
protocol_kx.KX_FLAG_SEND], is_extended_id=False)
|
||||||
try:
|
try:
|
||||||
self.can0.send(messageK)
|
self.can0.send(messageK)
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
@@ -59,19 +58,12 @@ class KX:
|
|||||||
print("Flash NOT sent")
|
print("Flash NOT sent")
|
||||||
|
|
||||||
|
|
||||||
def send_test_source_enable(self, x, y, xVel, yVel):
|
def send_test_source_enable(self, enabaled):
|
||||||
resetMsg = can.Message(
|
msg = protocol_kx.CANMsgK(self.sbl_id, 0, protocol_kx.KX_FLAG_WRITE_REQ, K)
|
||||||
arbitration_id=0xA,
|
messageK = can.Message(arbitration_id=0x2BB, data=[self.sbl_id, protocol_kx.KDescription.K_TEST_SOURCES_ENABLED, 0,
|
||||||
data=[
|
protocol_kx.KX_FLAG_WRITE_REQ, 0, 0, 0, enabaled], is_extended_id=False)
|
||||||
0x53,
|
self.can0.send(messageK)
|
||||||
0xFF,
|
self.sendK()
|
||||||
struct.pack('b', int(x))[0],
|
self.writeToFlashK()
|
||||||
struct.pack('B', int(y))[0],
|
time.sleep(0.1)
|
||||||
struct.pack('b', int(xVel))[0],
|
self.reset()
|
||||||
struct.pack('b', int(yVel))[0],
|
|
||||||
0x68,
|
|
||||||
0xA4
|
|
||||||
],
|
|
||||||
is_extended_id=False
|
|
||||||
)
|
|
||||||
self.can0.send(resetMsg)
|
|
||||||
7
main.py
7
main.py
@@ -3,12 +3,12 @@ import can
|
|||||||
import protocol_kx
|
import protocol_kx
|
||||||
import struct
|
import struct
|
||||||
import os
|
import os
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
can0 = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=500000)
|
can0 = can.interface.Bus(bustype='socketcan', channel='can0', bitrate=500000)
|
||||||
|
|
||||||
KXLOX = kx.KX(protocol_kx.KDescription.K_TEST_SOURCE_2_SIGLVL.value, 950, 255, can0)
|
KXLOX = kx.KX(protocol_kx.KDescription.K_TEST_SOURCE_2_SIGLVL.value, 950, 255, can0)
|
||||||
|
KXLOX.send_test_source_enable(0)
|
||||||
KXLOX.KXInit(protocol_kx.KDescription.K_SBL_ID.value, 43)
|
KXLOX.KXInit(protocol_kx.KDescription.K_SBL_ID.value, 43)
|
||||||
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_X_MAX.value, 21)
|
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_X_MAX.value, 21)
|
||||||
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_Y_MAX.value, 21)
|
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_Y_MAX.value, 21)
|
||||||
@@ -18,8 +18,5 @@ KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_Y.value, 7)
|
|||||||
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_X.value, 7)
|
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_POS_X.value, 7)
|
||||||
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_SIGLVL.value, 450)
|
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCE_1_SIGLVL.value, 450)
|
||||||
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCES_ENABLED.value, 1)
|
KXLOX.KXInit(protocol_kx.KDescription.K_TEST_SOURCES_ENABLED.value, 1)
|
||||||
KXLOX.sendK()
|
KXLOX.send_test_source_enable(1)
|
||||||
KXLOX.writeToFlashK()
|
|
||||||
time.sleep(0.1)
|
|
||||||
KXLOX.reset()
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user