git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
strat db + avoid
[aversive.git]
/
projects
/
microb2010
/
mainboard
/
robotsim.c
diff --git
a/projects/microb2010/mainboard/robotsim.c
b/projects/microb2010/mainboard/robotsim.c
index
5fc2e37
..
db161b8
100644
(file)
--- a/
projects/microb2010/mainboard/robotsim.c
+++ b/
projects/microb2010/mainboard/robotsim.c
@@
-67,11
+67,16
@@
void robotsim_dump(void)
{
char buf[BUFSIZ];
int len;
{
char buf[BUFSIZ];
int len;
+ int16_t x, y, a;
+
+ x = position_get_x_s16(&mainboard.pos);
+ y = position_get_y_s16(&mainboard.pos);
+ a = position_get_a_deg_s16(&mainboard.pos);
+/* y = COLOR_Y(y); */
+/* a = COLOR_A(a); */
len = snprintf(buf, sizeof(buf), "pos=%d,%d,%d\n",
len = snprintf(buf, sizeof(buf), "pos=%d,%d,%d\n",
- position_get_x_s16(&mainboard.pos),
- position_get_y_s16(&mainboard.pos),
- position_get_a_deg_s16(&mainboard.pos));
+ x, y, a);
hostsim_lock();
write(fdw, buf, len);
hostsim_unlock();
hostsim_lock();
write(fdw, buf, len);
hostsim_unlock();
@@
-91,14
+96,17
@@
robotsim_i2c_ballboard_set_mode(struct i2c_cmd_ballboard_set_mode *cmd)
return 0;
}
return 0;
}
-
static
int8_t
-robotsim_i2c_cobboard_set_mode(
struct i2c_cmd_cobboard_set_mode *cmd
)
+int8_t
+robotsim_i2c_cobboard_set_mode(
uint8_t mode
)
{
char buf[BUFSIZ];
int len;
{
char buf[BUFSIZ];
int len;
- cobboard.mode = cmd->mode;
- len = snprintf(buf, sizeof(buf), "cobboard=%d\n", cmd->mode);
+ if (cobboard.mode == mode)
+ return 0;
+
+ cobboard.mode = mode;
+ len = snprintf(buf, sizeof(buf), "cobboard=%d\n", mode);
hostsim_lock();
write(fdw, buf, len);
hostsim_unlock();
hostsim_lock();
write(fdw, buf, len);
hostsim_unlock();
@@
-127,15
+135,17
@@
robotsim_i2c_ballboard(uint8_t addr, uint8_t *buf, uint8_t size)
static int8_t
robotsim_i2c_cobboard(uint8_t addr, uint8_t *buf, uint8_t size)
{
static int8_t
robotsim_i2c_cobboard(uint8_t addr, uint8_t *buf, uint8_t size)
{
- void *void_cmd = buf;
+
//
void *void_cmd = buf;
switch (buf[0]) {
switch (buf[0]) {
+#if 0 /* deleted */
case I2C_CMD_COBBOARD_SET_MODE:
{
struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;
robotsim_i2c_cobboard_set_mode(cmd);
break;
}
case I2C_CMD_COBBOARD_SET_MODE:
{
struct i2c_cmd_cobboard_set_mode *cmd = void_cmd;
robotsim_i2c_cobboard_set_mode(cmd);
break;
}
+#endif
default:
break;
}
default:
break;
}