Skip to content

Commit

Permalink
add wall sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
tballmsft committed Sep 26, 2023
1 parent f6fde09 commit 54a777a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
20 changes: 19 additions & 1 deletion assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace microcode {
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_SENSOR_CAR_WALL] = icondb.car_wall
}

// TODO: factor out all the jacdac stuff into separate file/class
Expand Down Expand Up @@ -3030,7 +3031,24 @@ export const car_stop = img`
. . . . . . . . . . . . . . . .
`


export const car_wall = img`
. . . . . . . . . . . . . . . .
b b b b b b b b b b b b b b b b
2 2 2 2 b 2 2 2 2 b 2 2 2 2 b 2
2 2 2 2 b 2 2 2 2 b 2 2 2 2 b 2
b b b b b b b b b b b b b b b b
2 2 b 2 2 2 2 b 2 2 2 2 b 2 2 2
2 2 b 2 2 2 2 b 2 2 2 2 b 2 2 2
b b b b b b b b b b b b b b b b
2 2 2 2 b 2 2 2 2 b 2 2 2 2 b 2
2 2 2 2 b 2 2 2 2 b 2 2 2 2 b 2
b b b b b b b b b b b b b b b b
2 2 b 2 2 2 2 b 2 2 2 2 b 2 2 2
2 2 b 2 2 2 2 b 2 2 2 2 b 2 2 2
b b b b b b b b b b b b b b b b
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`

/* maybe use these later
export const rc_high = img`
Expand Down
12 changes: 12 additions & 0 deletions tiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace microcode {
export const TID_SENSOR_MAGNET = "S10"
export const TID_SENSOR_SLIDER = "S11"
export const TID_SENSOR_ROTARY = "S12"
export const TID_SENSOR_CAR_WALL = "S13"

// filters for TID_SENSOR_PRESS
export const TID_FILTER_PIN_0 = "F0"
Expand Down Expand Up @@ -261,6 +262,17 @@ namespace microcode {
]
slider.constraints.handling = { terminal: true }

const wall = makeSensor(TID_SENSOR_CAR_WALL, "value_in", 500)
wall.constraints.allow.categories = []
wall.constraints.allow.tiles = [
TID_FILTER_COIN_1,
TID_FILTER_COIN_2,
TID_FILTER_COIN_3,
TID_FILTER_COIN_4,
TID_FILTER_COIN_5,
]
wall.constraints.handling = { terminal: true }

const magnet = makeSensor(TID_SENSOR_MAGNET, "value_in", 500)
magnet.serviceClassName = "magneticFieldLevel"
magnet.jdExternalClass = 0x12fe180f
Expand Down

0 comments on commit 54a777a

Please sign in to comment.