Skip to content

Commit

Permalink
Invert tube direction
Browse files Browse the repository at this point in the history
  • Loading branch information
1D17B65E committed Oct 22, 2024
1 parent dce453e commit ea788ee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ASCET-DEVELOPER/BalanceTube/hardware/HandDistanceSensor.bd
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ blockdiagramSpecification Main {
inPin
}
}
literal Numeric "1.0" at (171, 203) size (49, 0) {
literal Numeric "0.0" at (171, 203) size (49, 0) {
label at (0, 4)
outPin {
connection_2
}
}
literal Numeric "0.0" at (171, 223) size (49, 0) {
literal Numeric "1.0" at (171, 223) size (49, 0) {
label at (0, 4)
outPin {
connection_1
Expand All @@ -118,4 +118,4 @@ blockdiagramSpecification Main {
inPin connection_10
}
}
}
}
6 changes: 3 additions & 3 deletions ASCET-DEVELOPER/BalanceTube/hardware/HandDistanceSensor.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ writes Signals.handPosition {
characteristic real adcMax = 2000.0;

@thread
@generated("blockdiagram", "931aadb8")
@generated("blockdiagram", "54d31754")
public void read() {
Signals.handPosition = min(max(m.map(Signals.adcHandPosition, adcMin, adcMax, 1.0, 0.0), 0.0), 1.0); // Main/read 1
Signals.handPosition = min(max(m.map(Signals.adcHandPosition, adcMin, adcMax, 0.0, 1.0), 0.0), 1.0); // Main/read 1
}
}
}
4 changes: 2 additions & 2 deletions ASCET-DEVELOPER/BalanceTube/tests/BalanceTubeTest.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ reads Signals.handPosition {
public void handPositionNormalization() {
Signals.adcHandPosition = sensor.adcMin;
sensor.read();
assert.assertDoubleEqual(Signals.handPosition, 1.0);
assert.assertDoubleEqual(Signals.handPosition, 0.0);

Signals.adcHandPosition = (sensor.adcMax + sensor.adcMin) / 2;
sensor.read();
assert.assertDoubleEqual(Signals.handPosition, 0.5);

Signals.adcHandPosition = sensor.adcMax;
sensor.read();
assert.assertDoubleEqual(Signals.handPosition, 0.0);
assert.assertDoubleEqual(Signals.handPosition, 1.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void hardware_HandDistanceSensor_Automatic_read (void)
float32 _t1real32;

_t1real32
= hardware_MappingUtil_Automatic_map(model_Signals_adcHandPosition__hardware_HandDistanceSensor_Automatic_read, adcMin_VAL, adcMax_VAL, 1.0F, 0.0F);
= hardware_MappingUtil_Automatic_map(model_Signals_adcHandPosition__hardware_HandDistanceSensor_Automatic_read, adcMin_VAL, adcMax_VAL, 0.0F, 1.0F);
model_Signals_handPosition__hardware_HandDistanceSensor_Automatic_read
= ((_t1real32 >= 0.0F) ? (((_t1real32 <= 1.0F) ? _t1real32 : 1.0F)) : 0.0F);
}
Expand Down

0 comments on commit ea788ee

Please sign in to comment.