From 7138ee9cb92e36b898bc722d08755a3074049e66 Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Thu, 28 Sep 2023 17:12:28 -0700 Subject: [PATCH] test before push --- jacs_topwriter.ts | 26 +++++++++++++++++++++++--- tiles.ts | 5 ++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/jacs_topwriter.ts b/jacs_topwriter.ts index bd98b785..ff6580b1 100644 --- a/jacs_topwriter.ts +++ b/jacs_topwriter.ts @@ -1113,9 +1113,29 @@ namespace jacs { wr, wr.emitBufLoad(NumFmt.F64, 12) ) - // TODO: ignore values in tiles.ts: car_commands - // TODO: special case on wall collision - filterValueIn(() => radioVar.read(wr)) + // hack for keeping car radio from interfering with user radio + if (sensor.tid == microcode.TID_SENSOR_CAR_WALL) { + wr.emitIf( + wr.emitExpr(Op.EXPR2_LT, [ + literal(0xfffff10), + radioVar.read(wr), + ]), + () => { + radioVar.write( + wr, + wr.emitExpr(Op.EXPR2_SUB, [radioVar.read(wr), literal(0xfffff10)])) + filterValueIn(() => radioVar.read(wr)) + }) + } else { + wr.emitIf( + wr.emitExpr(Op.EXPR2_LT, [ + radioVar.read(wr), + literal(0xfffff10) + ]), + () => { + filterValueIn(() => radioVar.read(wr)) + }) + } } ) } else if ( diff --git a/tiles.ts b/tiles.ts index fec49a13..bea1425d 100644 --- a/tiles.ts +++ b/tiles.ts @@ -265,9 +265,12 @@ namespace microcode { if (car_tiles) { const wall = makeSensor(TID_SENSOR_CAR_WALL, "value_in", 500) + wall.serviceClassName = "radio" + wall.eventCode = 0x91 + wall.jdKind = JdKind.Radio wall.constraints.allow.categories = [] wall.constraints.allow.tiles = only5 - wall.constraints.handling = { terminal: true } + wall.constraints.handling = { terminal: true } } const magnet = makeSensor(TID_SENSOR_MAGNET, "value_in", 500)