From 5705aa41017fb3481320f450a9a9b15961649ed5 Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Tue, 26 Sep 2023 19:01:14 -0700 Subject: [PATCH] fix code gen bug --- assets.ts | 10 +++++----- tiles.ts | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/assets.ts b/assets.ts index 1ff62c07..29731272 100644 --- a/assets.ts +++ b/assets.ts @@ -20,11 +20,11 @@ namespace microcode { function carImages(reg: name2Image) { reg[TID_ACTUATOR_CAR] = icondb.car - reg[TID_ACTUATOR_CAR_FORWARD] = icondb.car_forward - reg[TID_ACTUATOR_CAR_REVERSE] = icondb.car_reverse - reg[TID_ACTUATOR_CAR_TURN_LEFT] = icondb.car_left_turn - reg[TID_ACTUATOR_CAR_TURN_RIGHT] = icondb.car_right_turn - reg[TID_ACTUATOR_CAR_STOP] = icondb.car_stop + reg[TID_MODIFIER_CAR_FORWARD] = icondb.car_forward + reg[TID_MODIFIER_CAR_REVERSE] = icondb.car_reverse + reg[TID_MODIFIER_CAR_TURN_LEFT] = icondb.car_left_turn + reg[TID_MODIFIER_CAR_TURN_RIGHT] = icondb.car_right_turn + reg[TID_MODIFIER_CAR_STOP] = icondb.car_stop reg[TID_SENSOR_CAR_WALL] = icondb.car_wall } diff --git a/tiles.ts b/tiles.ts index ca59a187..f27aaac6 100644 --- a/tiles.ts +++ b/tiles.ts @@ -129,11 +129,11 @@ namespace microcode { export const TID_MODIFIER_SERVO_SET_ANGLE = "A21_" export const TID_ACTUATOR_CAR = "CAR" - export const TID_ACTUATOR_CAR_FORWARD = "CAR1" - export const TID_ACTUATOR_CAR_REVERSE = "CAR2" - export const TID_ACTUATOR_CAR_TURN_LEFT = "CAR3" - export const TID_ACTUATOR_CAR_TURN_RIGHT = "CAR4" - export const TID_ACTUATOR_CAR_STOP = "CAR5" + export const TID_MODIFIER_CAR_FORWARD = "CAR1" + export const TID_MODIFIER_CAR_REVERSE = "CAR2" + export const TID_MODIFIER_CAR_TURN_LEFT = "CAR3" + export const TID_MODIFIER_CAR_TURN_RIGHT = "CAR4" + export const TID_MODIFIER_CAR_STOP = "CAR5" export const PAGE_IDS = [ TID_MODIFIER_PAGE_1, @@ -434,14 +434,6 @@ namespace microcode { const swtch = addActuator(TID_ACTUATOR_SWITCH_PAGE, ["page"]) swtch.priority = 110 - if (car_tiles) { - const car = addActuator(TID_ACTUATOR_CAR, ["car"]) - car.priority = 200 - car.jdKind = JdKind.Sequence - car.serviceClassName = "radio" - car.serviceCommand = 0x81 - } - function addAssign(tid: string, id: number) { const theVar = addActuator(tid, ["value_out", "constant"]) theVar.jdParam = id @@ -514,6 +506,7 @@ namespace microcode { m.constraints.handling.terminal = true m.jdKind = JdKind.Page }) + if (car_tiles) { const car_commands = [ 0xfffff001, // forward @@ -523,6 +516,13 @@ namespace microcode { 0xfffff005 // stop ] make_vals(car_commands, "car", "CAR", 1) + + const car = addActuator(TID_ACTUATOR_CAR, ["car"]) + car.priority = 200 + car.jdKind = JdKind.Sequence + car.serviceClassName = "radio" + car.serviceCommand = 0x81 + car.defaultModifier = tilesDB.modifiers[TID_MODIFIER_CAR_STOP] } function addRGB(id: number, color: number) {