Comments (17)
I think you should be the opener for both issues
from benqprojector.py.
I think you should be the opener for both issues
I thought there's a recover function for a deleted issue. But no problem, I recreate it and creat the other one for the menu command.
from benqprojector.py.
Just give me some time to finish some code and commit that I'm woking on. I'll get back to you
from benqprojector.py.
@pkoevesdi, the regex is used to validate the response.
According to the BenQ documentation the response should be *<command>=<value>#
. On my own projector I already noticed that one command does not respond with a leading *
. I will lossen the regex a bit by also making the #
optional. Making the =
optional is a bit more complex. Do you have an example when this happens?
from benqprojector.py.
You comment would belong to the regex issue, but I cannot find it any more, did You delete it again? To me, the regex issue seems a different thing than the lamp parsing.
Example for missing =
:
echo -e "\r*up#\r" > /dev/virtualcom0
Answer:
*up#
from benqprojector.py.
Ah, allright, I thought you recreated the regex issue, but this one is indeed about he lamp. Yes, I deleted the other one. Sorry for the confusion
from benqprojector.py.
Ok, let's split it up: Do You recreate the regex issue? I'll make another one for the menu thing.
from benqprojector.py.
Ok, getting back to the lamp parsing, this is actually also a regex issue since the missing #
is why the response is considered invalid. The space is also not really expexted, or at least the BenQ documentation doesn't mention it, however the code doesn't really care when converting the response to an integer.
New version of the code now has a more lose regex
from benqprojector.py.
Ok, thank You for implementing.
Now I get this:
2023-01-15 18:23:37,973 DEBUG Processed response: 1386
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/gauner/.local/lib/python3.10/site-packages/benqprojector/__main__.py", line 43, in <module>
projector.update()
File "/home/gauner/.local/lib/python3.10/site-packages/benqprojector/benqprojector.py", line 618, in update
self.lamp_time = int(response)
ValueError: invalid literal for int() with base 10: '\x00 1386'
Seems like something is still before the lamp hours number?
from benqprojector.py.
Ok, I replaced all int(###)
with int(re.sub('[^0-9]','', ###))
inside benqprojector.py
, just as a quick workaround. Actually, the line 310 .strip(" \n\r\x00")
is supposed to make the above output impossible?
But now many of the problematic numbers work. Next problem occurs: my projector answers some commands the follwing way: first repeating the command, and then answering with the value:
>*bri=?#
*bri=?#
*bri= 51
in difference to:
>*ltim=?#
*ltim= 1386
This is at least true for *bri=?#
, *con=?#
, *color=?#
, *sharp=?#
,...
I could easily fix this for my projector. But this could easily break others. Any idea how to solve this in a model agnostic way? Does You projector answer these commands without repeating them?
May we could check the response if it is a ?
again and repeat the command if it is. I'll try something out.
from benqprojector.py.
I'm also doing development on the library at the moment, and the trailing spaces have been fixed by stripping of the spaces before returning the response.
Commands are not really repeated, but echoed instead. The first line you read is the echo of the command. Hence the detection of command echoes in the code. By the way, not all projectors seem to echo the commands. The code tries to detect is command echoes are used by the projector.
from benqprojector.py.
Ok, it works on my side, if You not strip only the spaces in line 381, but also the line feeds and other stuff, same as You do in line 310. The problem with the command repetition stays.
from benqprojector.py.
Commands are not really repeated, but echoed instead. The first line you read is the echo of the command.
Yes, the first line is the echo, after the >
. What I wanted to say is: There's a second echo for some commands. Compare ltim
, echoed once, and bri
, echoed twice.
I've made some changes too, now the examine
and status
commands run well on my side. I can make a pull request, or wait, what You've got.
from benqprojector.py.
I'm finished with making my changes. If you could test my code and if needed add your changes and a pull request
from benqprojector.py.
Ok, I'll do it.
Just some things I figured out, take it as a note to myself:
- Everything runs more stable with higher timeout.
- Some commands in
examine
(mostly some the "illegal format" ones) end up with a command prompt, some don't. If they do, from then on the script gets out of step and almost everything afterwards fails. Have to look for a way to figure out this condition and exit command prompt from projector first, before issuing the next command (which puts him into command prompt again by beginning with\r
).
from benqprojector.py.
Good points.
The timeout is to be 50 milliseconds on line 19 of benqprojector.py
. This timeout seems to work fine for my projector and that's why I took that value. Might very well be that other models need other timeouts. The thing is that with a higher value retrieving the status of the projector can become exponentially slower.
from benqprojector.py.
Lamp time is now being processes properly.
Getting back to the stability, I improved the prompt handling so now the code will wait till the prompt is there before sending a new command. See function _wait_for_prompt
I'm closing his issue, if stability is still to be desired a new issue can be opened
from benqprojector.py.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from benqprojector.py.