- if (corn_is_near(&lidx, I2C_LEFT_SIDE)) {
- if (lcob != I2C_COB_NONE)
- corn_set_color(strat_db.corn_table[lidx], lcob);
+ lcob_near = corn_is_near(&lidx, I2C_LEFT_SIDE);
+ if (lcob_near && lcob != I2C_COB_NONE) {
+ if (strat_db.corn_table[lidx]->corn.color == I2C_COB_UNKNOWN)
+ DEBUG(E_USER_STRAT, "lcob %s %d",
+ lcob == I2C_COB_WHITE ? "white" : "black", lidx);
+ corn_set_color(strat_db.corn_table[lidx], lcob);
+ }
+
+ /* detect cob on right side */
+ rcob_near = corn_is_near(&ridx, I2C_RIGHT_SIDE);
+ if (rcob_near && rcob != I2C_COB_NONE) {
+ if (strat_db.corn_table[ridx]->corn.color == I2C_COB_UNKNOWN)
+ DEBUG(E_USER_STRAT, "rcob %s %d",
+ rcob == I2C_COB_WHITE ? "white" : "black", ridx);
+ corn_set_color(strat_db.corn_table[ridx], rcob);
+ }