Skip to content

Commit 02489b3

Browse files
Methods: Update neodevice_to_string with all devices in icsnVC40 (#148)
* Methods: Update neodevice_to_string with all devices in icsnVC40 * WIP: Adding LIN settings update example * Update and rename lin_settings_example.py to lin_settings_fire3_example.py cleaned up example to simplify it. --------- Co-authored-by: David Rebbe <drebbe@intrepidcs.com>
1 parent a8ba18c commit 02489b3

2 files changed

Lines changed: 49 additions & 3 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import ics
2+
import random
3+
import time
4+
5+
def dev_name(device):
6+
# Return a friendly name of the device (ie. neoVI FIRE2 CY1234)
7+
if int("A00000", 36) <= device.SerialNumber <= int("ZZZZZZ", 36):
8+
return device.Name + " " + ics.base36enc(device.SerialNumber)
9+
else:
10+
return device.Name + " " + str(device.SerialNumber)
11+
12+
def print_settings(settings):
13+
print("LIN 1 Baudrate:" + str(settings.Settings.fire3.lin1.Baudrate))
14+
print("LIN 1 Master resistor:" + ("OFF" if settings.Settings.fire3.lin1.MasterResistor else "ON"))
15+
print("LIN 2 Baudrate:" + str(settings.Settings.fire3.lin2.Baudrate))
16+
print("LIN 2 Master resistor:" + ("OFF" if settings.Settings.fire3.lin2.MasterResistor else "ON"))
17+
18+
if __name__ == "__main__":
19+
try:
20+
# Open the first device
21+
device = ics.open_device()
22+
print("Opened Device {dev_name(device)} (Open Client handles: {device.NumberOfClients})...")
23+
except ics.RuntimeError as ex:
24+
print("Failed to open first device: {ex}")
25+
exit(1)
26+
print("Reading settings...")
27+
settings = ics.get_device_settings(device)
28+
print(settings)
29+
print("Writing settings...")
30+
settings.Settings.fire3.lin1.Baudrate = 19200
31+
settings.Settings.fire3.lin1.MasterResistor = 0
32+
ics.set_device_settings(device, settings)
33+
print(settings)

src/methods.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,16 @@ char* neodevice_to_string(unsigned long type)
104104
return "RAD-Gigastar";
105105
case NEODEVICE_RED2:
106106
return "neoVI RED 2";
107+
case NEODEVICE_FIRE2_REDLINE:
108+
return "neoVI FIRE 2 Redline";
107109
case NEODEVICE_ETHER_BADGE:
108110
return "EtherBADGE";
109111
case NEODEVICE_RAD_A2B:
110112
return "RAD-A2B";
111113
case NEODEVICE_RADEPSILON:
112114
return "RAD-Epsilon";
113115
case NEODEVICE_OBD2_SIM_DOIP:
116+
case NEODEVICE_OBD2_SIM:
114117
return "neoOBD2-SIM";
115118
case NEODEVICE_OBD2_DEV:
116119
return "neoOBD2-DEV";
@@ -126,25 +129,29 @@ char* neodevice_to_string(unsigned long type)
126129
return "RAD-wBMS";
127130
case NEODEVICE_RADMOON3:
128131
return "RAD-Moon3";
132+
case NEODEVICE_RADCOMET:
133+
return "RAD-Comet";
134+
case NEODEVICE_FIRE3_FLEXRAY:
135+
return "neoVI FIRE 3 Flexray";
129136
case NEODEVICE_RED:
130137
return "neoVI RED";
131138
case NEODEVICE_ECU:
132139
return "neoECU";
133-
case NEODEVICE_IEVB:
140+
case NEODEVICE_IEVB: //also NEODEVICE_NEOECUCHIP
134141
return "IEVB";
135142
case NEODEVICE_PENDANT:
136143
return "Pendant";
137144
case NEODEVICE_OBD2_PRO:
138145
return "neoOBD2 PRO";
139146
case NEODEVICE_ECUCHIP_UART:
140147
return "ECUCHIP";
141-
case NEODEVICE_PLASMA:
148+
case NEODEVICE_PLASMA: //also NEODEVICE_ANY_PLASMA
142149
return "neoVI PLASMA";
143150
case NEODEVICE_NEOANALOG:
144151
return "neoAnalog";
145152
case NEODEVICE_CT_OBD:
146153
return "neoOBD CT";
147-
case NEODEVICE_ION:
154+
case NEODEVICE_ION: //also NEODEVICE_ANY_ION
148155
return "neoVI ION";
149156
case NEODEVICE_RADSTAR:
150157
return "RAD-Star";
@@ -168,6 +175,12 @@ char* neodevice_to_string(unsigned long type)
168175
return "RAD-Star 2";
169176
case NEODEVICE_VIVIDCAN:
170177
return "VividCAN";
178+
case NEODEVICE_DONT_REUSE0:
179+
case NEODEVICE_DONT_REUSE1:
180+
case NEODEVICE_DONT_REUSE2:
181+
case NEODEVICE_DONT_REUSE3:
182+
default:
183+
return "Unknown";
171184
};
172185
return "Intrepid Device";
173186
}

0 commit comments

Comments
 (0)