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

Support manufacturer-specific parameters #47

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ff45034
Update rdm.h
TimMJN Jun 4, 2023
6fce9a3
implement parameters
TimMJN Jun 4, 2023
120aa1c
move into dir
TimMJN Jun 4, 2023
779518c
integrate sensors example
TimMJN Jun 5, 2023
33b380d
Update RDMSerialRecv.ino
TimMJN Jun 5, 2023
206e07b
Create RDMSerialRecvParameter.ino
TimMJN Jun 5, 2023
1b629b0
Update RDMSerialRecvParameter.ino
TimMJN Jun 6, 2023
c95a9c2
Update RDMSerialRecvSensor.ino
TimMJN Jun 6, 2023
89330b8
Update RDMSerialRecv.ino
TimMJN Jun 6, 2023
b676b51
Update DMXSerial2.h
TimMJN Jun 6, 2023
7a04e00
Update src/DMXSerial2.cpp
TimMJN Jun 6, 2023
7f5dc82
Update src/DMXSerial2.cpp
TimMJN Jun 6, 2023
df16351
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
d2678fc
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
bde3c2a
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
ee74c82
change WRITELONG to WRITEINT32
TimMJN Jun 6, 2023
d7e9214
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
121e625
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
2e6551a
Update src/DMXSerial2.h
TimMJN Jun 6, 2023
fb0c8e1
Update src/DMXSerial2.cpp
TimMJN Jun 6, 2023
1081219
update nackReason for unknown manufacturer PID
TimMJN Jun 6, 2023
f4ed6d8
change parameterNr to parameterIndex, add pid to callback functions
TimMJN Jun 6, 2023
ec99b3e
support sensor (re)set, return 0x0000 for unsupported sensor functions
TimMJN Jun 6, 2023
092aac0
bugfixes
TimMJN Jun 7, 2023
8048876
added a catch for non-ascii characters in the device label
TimMJN Jun 10, 2023
e04ebe4
move _saveEEPRom after response has been sent
TimMJN Jun 10, 2023
b55fd58
Update src/DMXSerial2.h
TimMJN Jun 11, 2023
e05abdc
Update src/DMXSerial2.h
TimMJN Jun 11, 2023
0c924d5
implement resetting all sensors
TimMJN Jun 11, 2023
1b261ac
Merge branch 'master' of https://github.com/TimMJN/DmxSerial2
TimMJN Jun 11, 2023
79f2c8c
Update RDMSerialRecvParameter.ino
TimMJN Jun 11, 2023
05f46d9
correct terminilogy
TimMJN Jun 11, 2023
3d5bacd
typo
TimMJN Jun 11, 2023
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
Prev Previous commit
Next Next commit
implement resetting all sensors
  • Loading branch information
TimMJN committed Jun 11, 2023
commit 0c924d582294a178344e50b62afec89c5f774236
52 changes: 28 additions & 24 deletions src/DMXSerial2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ void DMXSerialClass2::_processRDMMessage(byte CmdClass, uint16_t Parameter, bool
nackReason = E120_NR_SUB_DEVICE_OUT_OF_RANGE;
} else {
uint8_t sensorNr = _rdm.packet.Data[0];
if (sensorNr >= _initData->sensorsLength) {
if (sensorNr >= _initData->sensorsLength || sensorNr == 0xFF) {
// Out of range sensor
nackReason = E120_NR_DATA_OUT_OF_RANGE;
} else {
Expand Down Expand Up @@ -956,32 +956,36 @@ void DMXSerialClass2::_processRDMMessage(byte CmdClass, uint16_t Parameter, bool
nackReason = E120_NR_SUB_DEVICE_OUT_OF_RANGE;
} else {
uint8_t sensorNr = _rdm.packet.Data[0];
if (sensorNr >= _initData->sensorsLength) {
if (sensorNr >= _initData->sensorsLength && sensorNr != 0xFF) {
// Out of range sensor
nackReason = E120_NR_DATA_OUT_OF_RANGE;
} else {
int16_t sensorValue = 0;
int16_t lowestValue = 0;
int16_t highestValue = 0;
int16_t recordedValue = 0;
bool8 res = false;
if (_sensorFunc) {
res = _sensorFunc(sensorNr, &sensorValue, &lowestValue, &highestValue, &recordedValue);
}
if (res) {
_rdm.packet.DataLength = 9;
_rdm.packet.Data[0] = sensorNr;
WRITEINT(_rdm.packet.Data + 1, sensorValue);
WRITEINT(_rdm.packet.Data + 3, (_initData->sensors[sensorNr].lowHighSupported ? sensorValue : 0));
WRITEINT(_rdm.packet.Data + 5, (_initData->sensors[sensorNr].lowHighSupported ? sensorValue : 0));
WRITEINT(_rdm.packet.Data + 7, (_initData->sensors[sensorNr].recordedSupported ? sensorValue : 0));
handled = true;
} else {
nackReason = E120_NR_HARDWARE_FAULT;
}
}
}
}
for (int i = 0; i<_initData->sensorsLength; i++) {
if (i == sensorNr || sensorNr == 0xFF) {
int16_t sensorValue = 0;
int16_t lowestValue = 0;
int16_t highestValue = 0;
int16_t recordedValue = 0;
bool8 res = false;
if (_sensorFunc) {
res = _sensorFunc(i, &sensorValue, &lowestValue, &highestValue, &recordedValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do something clever here if we're in 0xff mode. Ideally ANDing all the results, but obviously not the default initialisation...

Tracking failure would mean we could OR it I think.

}
if (res) {
_rdm.packet.DataLength = 9;
_rdm.packet.Data[0] = i;
WRITEINT(_rdm.packet.Data + 1, sensorValue);
WRITEINT(_rdm.packet.Data + 3, (_initData->sensors[i].lowHighSupported ? sensorValue : 0));
WRITEINT(_rdm.packet.Data + 5, (_initData->sensors[i].lowHighSupported ? sensorValue : 0));
WRITEINT(_rdm.packet.Data + 7, (_initData->sensors[i].recordedSupported ? sensorValue : 0));
handled = true;
} else {
nackReason = E120_NR_HARDWARE_FAULT;
}
} // if
} // for
} // else
} // else
} // else if

} else if (Parameter == SWAPINT(E120_SENSOR_DEFINITION) && _initData->sensorsLength > 0) { // 0x0200
if (CmdClass == E120_GET_COMMAND) {
Expand Down
  NODES
COMMUNITY 2
Idea 1
idea 1
Note 1
Project 4
USERS 1