Skip to content

Commit

Permalink
Merge pull request #130 from EmixamPP/5.0.2
Browse files Browse the repository at this point in the history
v5.0.2
  • Loading branch information
EmixamPP authored Aug 22, 2023
2 parents a723062 + c08b01f commit 7c35507
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Wed Aug 23 2023 - 5.0.2
- Minor search fix
- Longer search by default
# Tue Aug 8 2023 - 5.0.0
- Automatic ir camera detection
- Automatic ir emitter configuration
Expand Down
3 changes: 1 addition & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project(
'linux-enable-ir-emitter',
'cpp',
version: '5.0.0',
version: '5.0.2',
license: 'MIT',
default_options: [
'prefix=/usr',
Expand Down Expand Up @@ -118,7 +118,6 @@ install_data(

install_data(
'LICENSE',
'README.md',
install_dir : lib_dir,
)

Expand Down
11 changes: 7 additions & 4 deletions sources/camera/camerainstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,25 @@ CameraInstruction::CameraInstruction(uint8_t unit, uint8_t selector, const vecto
* false if the maximum control has already been set
*/
bool CameraInstruction::next() noexcept
{
{
if (curCtrl == maxCtrl)
return false;

for (unsigned i = 0; i < curCtrl.size(); ++i)
{
uint16_t nextCtrli = static_cast<uint16_t>(curCtrl[i] + 1);
if (nextCtrli > maxCtrl[i])
curCtrl[i] = minCtrl[i]; // simulate "overflow"
else
else
{
curCtrl[i] = static_cast<uint8_t>(nextCtrli);
logDebugCtrl("new current:", curCtrl);
return true;
}
}
}

// all are in overflow (should never arrive!)
setMaxAsCur();

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion sources/command/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def configure(device: str | None, manual: bool, emitters: int, neg_answer_limit:
device (str | None): path to the infrared camera, None for automatic detection
manual (bool): true for enabling the manual configuration
emitters (int): number of emitters on the device
neg_answer_limit (int): after k negative answer the pattern will be skiped, use 256 for unlimited
neg_answer_limit (int): number of negative answer before the pattern is skiped. Use -1 for unlimited
"""
logging.info("Ensure to not use the camera during the execution.")
logging.info("Warning to do not kill the process !")
Expand Down
23 changes: 8 additions & 15 deletions sources/driver/finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,29 +119,22 @@ unique_ptr<vector<unique_ptr<Driver>>> Finder::find()
{
CameraInstruction instruction(camera, unit, selector);
const CameraInstruction initInstruction = instruction; // copy for reset later

if (!instruction.setMinAsCur()) // if no min instruction exists
if (!instruction.next()) // start from the next one
continue; // if no next, skip


instruction.setMinAsCur();
unsigned negAnswerCounter = 0;
do
{
while (negAnswerCounter < negAnswerLimit && instruction.next())
{
if (negAnswerCounter == negAnswerLimit - 1)
instruction.setMaxAsCur();

if (camera.apply(instruction) && camera.isEmitterWorking())
{
drivers->push_back(createDriverFromInstruction(instruction, unit, selector));
if (drivers->size() == emitters) // all emitters are configured
return drivers;
}
++negAnswerCounter;

if (negAnswerCounter == negAnswerLimit - 1)
{
instruction.setMaxAsCur();
continue;
}

} while (negAnswerCounter < negAnswerLimit && instruction.next());
}

camera.apply(initInstruction);
Logger::debug("");
Expand Down
4 changes: 2 additions & 2 deletions sources/linux-enable-ir-emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
"-l",
"--limit",
metavar="<count>",
help="the number of negative answer before the pattern is skipped, by default is 5. Use -1 for unlimited",
default=[5],
help="the number of negative answer before the pattern is skipped, by default is 40. Use -1 for unlimited",
default=[40],
type=int,
nargs=1,
)
Expand Down

0 comments on commit 7c35507

Please sign in to comment.