Skip to content
GitLab
Explore
Sign in
Davide Ricci
software-di-controllo
Compare revisions
3da50d7e5a34bfe5ea1c1a2da781e278a392aacf to d3ef0e12e5dc64c9b6819e8b1a05b693391e2dd0
Commits on Source (2)
debug with Silvano and students
· c02a6ca0
Davide Ricci
authored
Apr 18, 2024
c02a6ca0
socketio.on(connect) emits last status only to the new client_id
· d3ef0e12
Davide Ricci
authored
Apr 18, 2024
d3ef0e12
Hide whitespace changes
Inline
Side-by-side
app.py
View file @
d3ef0e12
...
...
@@ -5,7 +5,6 @@
# System modules
import
configparser
import
logging
import
time
# Third-party modules
...
...
config/constants.py
View file @
d3ef0e12
...
...
@@ -60,6 +60,7 @@ filter_state = {
}
filter_name
=
{
0
:
"
Undef.
"
,
1
:
"
U
"
,
2
:
"
B
"
,
3
:
"
V
"
,
...
...
web/pages/control.html
View file @
d3ef0e12
...
...
@@ -169,7 +169,7 @@ Control
</label>
<div
class=
"col-md col-1 input-group"
>
<input
class=
"form-control"
data-parameter=
"telescopeoffset-zd"
data-parameter=
"telescope
-
offset-zd"
value=
"-800"
type=
"number"
>
<input
class=
"form-control"
data-parameter=
"telescope-offset-az"
...
...
web/pages/init.html
View file @
d3ef0e12
...
...
@@ -207,7 +207,7 @@ Init panel
</label>
<div
class=
"col-md col-1 input-group"
>
<input
class=
"form-control"
data-parameter=
"telescopeoffset-zd"
data-parameter=
"telescope
-
offset-zd"
value=
"-800"
type=
"number"
>
<input
class=
"form-control"
data-parameter=
"telescope-offset-az"
...
...
web/server/instance.py
View file @
d3ef0e12
...
...
@@ -48,16 +48,16 @@ def enable(app):
@socketio.on
(
'
connect
'
)
def
handle_connect
():
print
(
"
Sending initial
"
)
# First connection
stream
.
status
.
initial
(
socketio
,
ws_names
)
print
(
"
Sent
"
)
client_id
=
request
.
sid
client_ip
=
request
.
remote_addr
connected_clients
[
client_id
]
=
client_ip
uniques
=
len
(
set
(
connected_clients
.
values
()))
print
(
f
"
Sending initial to
{
client_id
}
"
)
# First connection
stream
.
status
.
initial
(
socketio
,
ws_names
,
client
=
client_id
)
print
(
"
Sent
"
)
print
(
f
"
Connected:
{
client_id
}
- IP:
{
client_ip
}
. Tabs:
{
len
(
connected_clients
)
}
, IPs:
{
uniques
}
"
)
...
...
web/server/stream.py
View file @
d3ef0e12
...
...
@@ -12,15 +12,16 @@ from datetime import datetime
from
astropy.io
import
fits
# Custom modules
from
utils.logger
import
log
from
app
import
app
class
Status
:
def
__init__
(
self
):
self
.
last
=
{}
def
initial
(
self
,
socketio
,
names
):
def
initial
(
self
,
socketio
,
names
,
client
):
for
name
in
names
:
socketio
.
emit
(
name
,
self
.
last
[
name
])
socketio
.
emit
(
name
,
self
.
last
[
name
]
,
room
=
client
)
status
=
Status
()
...
...
@@ -60,7 +61,7 @@ def send_webcam(socketio, name, url, sleep=1):
status
.
last
[
name
]
=
bytes
(
img
)
socketio
.
emit
(
name
,
bytes
(
img
))
except
AttributeError
as
e
:
console
.
warning
(
f
"
Could not send webcam image:
{
e
}
"
)
log
.
warning
(
f
"
Could not send webcam image:
{
e
}
"
)
pass
...
...