Skip to content

Commit 8196e8a

Browse files
authored
Merge pull request #24 from SeanMollet/fix/boolregister-read-area-prefix
Fix BoolRegister.ReadAsync reading the DT area instead of X/Y/R
2 parents 1e27436 + 331e6a4 commit 8196e8a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

MewtocolNet/Registers/Classes/BoolRegister.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ private async Task<bool> WriteSingleBitAsync(bool val) {
116116
/// <inheritdoc/>
117117
public async Task<bool> ReadAsync() {
118118

119-
var res = await attachedInterface.ReadAreaByteRangeAsync((int)MemoryAddress, (int)GetRegisterAddressLen() * 2);
119+
//pass the register type, otherwise this falls back to the DT area default and
120+
//reads a data register instead of the X/Y/R bit area
121+
var res = await attachedInterface.ReadAreaByteRangeAsync((int)MemoryAddress, (int)GetRegisterAddressLen() * 2, RegisterType);
120122
if (res == null) throw new Exception($"Failed to read the register {this}");
121123

122124
var matchingReg = attachedInterface.memoryManager.GetAllRegisters()

0 commit comments

Comments
 (0)