Skip to content

Commit 7c35507

Browse files
authored
Merge pull request #130 from EmixamPP/5.0.2
v5.0.2
2 parents a723062 + c08b01f commit 7c35507

6 files changed

Lines changed: 22 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Wed Aug 23 2023 - 5.0.2
2+
- Minor search fix
3+
- Longer search by default
14
# Tue Aug 8 2023 - 5.0.0
25
- Automatic ir camera detection
36
- Automatic ir emitter configuration

meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project(
22
'linux-enable-ir-emitter',
33
'cpp',
4-
version: '5.0.0',
4+
version: '5.0.2',
55
license: 'MIT',
66
default_options: [
77
'prefix=/usr',
@@ -118,7 +118,6 @@ install_data(
118118

119119
install_data(
120120
'LICENSE',
121-
'README.md',
122121
install_dir : lib_dir,
123122
)
124123

sources/camera/camerainstruction.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,25 @@ CameraInstruction::CameraInstruction(uint8_t unit, uint8_t selector, const vecto
9191
* false if the maximum control has already been set
9292
*/
9393
bool CameraInstruction::next() noexcept
94-
{
94+
{
95+
if (curCtrl == maxCtrl)
96+
return false;
97+
9598
for (unsigned i = 0; i < curCtrl.size(); ++i)
9699
{
97100
uint16_t nextCtrli = static_cast<uint16_t>(curCtrl[i] + 1);
98101
if (nextCtrli > maxCtrl[i])
99102
curCtrl[i] = minCtrl[i]; // simulate "overflow"
100-
else
103+
else
101104
{
102105
curCtrl[i] = static_cast<uint8_t>(nextCtrli);
103106
logDebugCtrl("new current:", curCtrl);
104107
return true;
105-
}
108+
}
106109
}
107110

111+
// all are in overflow (should never arrive!)
108112
setMaxAsCur();
109-
110113
return false;
111114
}
112115

sources/command/configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def configure(device: str | None, manual: bool, emitters: int, neg_answer_limit:
1515
device (str | None): path to the infrared camera, None for automatic detection
1616
manual (bool): true for enabling the manual configuration
1717
emitters (int): number of emitters on the device
18-
neg_answer_limit (int): after k negative answer the pattern will be skiped, use 256 for unlimited
18+
neg_answer_limit (int): number of negative answer before the pattern is skiped. Use -1 for unlimited
1919
"""
2020
logging.info("Ensure to not use the camera during the execution.")
2121
logging.info("Warning to do not kill the process !")

sources/driver/finder.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,29 +119,22 @@ unique_ptr<vector<unique_ptr<Driver>>> Finder::find()
119119
{
120120
CameraInstruction instruction(camera, unit, selector);
121121
const CameraInstruction initInstruction = instruction; // copy for reset later
122-
123-
if (!instruction.setMinAsCur()) // if no min instruction exists
124-
if (!instruction.next()) // start from the next one
125-
continue; // if no next, skip
126-
122+
123+
instruction.setMinAsCur();
127124
unsigned negAnswerCounter = 0;
128-
do
129-
{
125+
while (negAnswerCounter < negAnswerLimit && instruction.next())
126+
{
127+
if (negAnswerCounter == negAnswerLimit - 1)
128+
instruction.setMaxAsCur();
129+
130130
if (camera.apply(instruction) && camera.isEmitterWorking())
131131
{
132132
drivers->push_back(createDriverFromInstruction(instruction, unit, selector));
133133
if (drivers->size() == emitters) // all emitters are configured
134134
return drivers;
135135
}
136136
++negAnswerCounter;
137-
138-
if (negAnswerCounter == negAnswerLimit - 1)
139-
{
140-
instruction.setMaxAsCur();
141-
continue;
142-
}
143-
144-
} while (negAnswerCounter < negAnswerLimit && instruction.next());
137+
}
145138

146139
camera.apply(initInstruction);
147140
Logger::debug("");

sources/linux-enable-ir-emitter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"-l",
6868
"--limit",
6969
metavar="<count>",
70-
help="the number of negative answer before the pattern is skipped, by default is 5. Use -1 for unlimited",
71-
default=[5],
70+
help="the number of negative answer before the pattern is skipped, by default is 40. Use -1 for unlimited",
71+
default=[40],
7272
type=int,
7373
nargs=1,
7474
)

0 commit comments

Comments
 (0)