summaryrefslogtreecommitdiff
path: root/digital/mimot
diff options
context:
space:
mode:
Diffstat (limited to 'digital/mimot')
-rw-r--r--digital/mimot/src/dirty/counter_ext.avr.c2
-rw-r--r--digital/mimot/tools/inter_mimot.py16
-rw-r--r--digital/mimot/tools/mimot/init.py14
-rw-r--r--digital/mimot/tools/write_eeprom.py17
4 files changed, 22 insertions, 27 deletions
diff --git a/digital/mimot/src/dirty/counter_ext.avr.c b/digital/mimot/src/dirty/counter_ext.avr.c
index 630f6cec..54bfa9f7 100644
--- a/digital/mimot/src/dirty/counter_ext.avr.c
+++ b/digital/mimot/src/dirty/counter_ext.avr.c
@@ -156,6 +156,7 @@ counter_update (void)
counter_update_step ();
/* Left counter. */
uint16_t left = counter_left_new_step;
+ left &= 0xffff << COUNTER_LEFT_SHIFT; /* Reset unused bits. */
#if !COUNTER_LEFT_REVERSE
counter_left_diff = (int16_t) (left - counter_left_old);
#else
@@ -166,6 +167,7 @@ counter_update (void)
counter_left += counter_left_diff;
/* Right counter. */
uint16_t right = counter_right_new_step;
+ right &= 0xffff << COUNTER_RIGHT_SHIFT; /* Reset unused bits. */
#if !COUNTER_RIGHT_REVERSE
counter_right_diff = (int16_t) (right - counter_right_old);
#else
diff --git a/digital/mimot/tools/inter_mimot.py b/digital/mimot/tools/inter_mimot.py
index 219c432b..414b61df 100644
--- a/digital/mimot/tools/inter_mimot.py
+++ b/digital/mimot/tools/inter_mimot.py
@@ -26,8 +26,7 @@ import math
import mimot
import mimot.init
-import proto.popen_io
-import serial
+from utils.init_proto import init_proto
from inter.inter import Inter
from Tkinter import *
@@ -35,15 +34,9 @@ from Tkinter import *
class InterMimot (Inter):
"""Inter, communicating with the mimot board."""
- def __init__ (self, argv):
+ def __init__ (self):
# Asserv.
- if argv[0] == '!':
- io = proto.popen_io.PopenIO (argv[1:])
- i = mimot.init.host
- else:
- io = serial.Serial (argv[0])
- i = mimot.init.target
- self.a = mimot.Proto (io, **i)
+ self.a = init_proto ('giboulee', mimot.Proto, mimot.init)
self.a.async = True
# Inter.
Inter.__init__ (self)
@@ -128,8 +121,7 @@ class InterMimot (Inter):
self.a.ftw (self.backwardVar.get ())
if __name__ == '__main__':
- import sys
- app = InterMimot (sys.argv[1:])
+ app = InterMimot ()
try:
app.mainloop ()
finally:
diff --git a/digital/mimot/tools/mimot/init.py b/digital/mimot/tools/mimot/init.py
index 471a27bb..1900de67 100644
--- a/digital/mimot/tools/mimot/init.py
+++ b/digital/mimot/tools/mimot/init.py
@@ -1,5 +1,5 @@
"""Default parameters for asserv."""
-host = dict (
+host_marcel = dict (
scale = 0.0395840674352314, f = 0xdd1,
tkp = 1, tkd = 16,
ta = 0.75, tsm = 0x20, tss = 0x10,
@@ -8,7 +8,12 @@ host = dict (
E = 0x3ff, D = 0x1ff,
l = 0x1000,
)
-target = dict (
+host = {
+ 'tazg': host_marcel,
+ 'giboulee': host_marcel,
+ 'marcel': host_marcel,
+ }
+target_marcel = dict (
scale = 0.0415178942124, f = 0xcef,
c = float (0x00ffbabf) / (1 << 24),
tkp = 1, tkd = 16,
@@ -19,3 +24,8 @@ target = dict (
l = 0x1000,
w = 0x00,
)
+target = {
+ 'tazg': target_marcel,
+ 'giboulee': target_marcel,
+ 'marcel': target_marcel,
+ }
diff --git a/digital/mimot/tools/write_eeprom.py b/digital/mimot/tools/write_eeprom.py
index ab2ae315..7fe54342 100644
--- a/digital/mimot/tools/write_eeprom.py
+++ b/digital/mimot/tools/write_eeprom.py
@@ -1,16 +1,7 @@
-import sys
-
import mimot
import mimot.init
-import proto.popen_io
-import serial
+from utils.init_proto import init_proto
-if sys.argv[1] == '!':
- io = proto.popen_io.PopenIO (sys.argv[2:])
- init = mimot.init.host
-else:
- io = serial.Serial (sys.argv[1])
- init = mimot.init.target
-a = mimot.Proto (io, **init)
-a.write_eeprom ()
-a.close ()
+m = init_proto (None, mimot.Proto, mimot.init)
+m.write_eeprom ()
+m.close ()