Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Invert tube direction" #8

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 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 Down
4 changes: 2 additions & 2 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