Commit 1da7ba1a authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Merge branch 'jeroen' of ssh://gitlab.camras.nl:777/dijkema/dt_ctrl into jeroen

parents c54185dd 4523cfcd
Pipeline #1 failed with stages
...@@ -4,9 +4,12 @@ ...@@ -4,9 +4,12 @@
# ``` # ```
# git clone gitlab.camras.nl/dijkema/dt_ctrl # git clone gitlab.camras.nl/dijkema/dt_ctrl
# ``` # ```
# Copy the Dockerfile to the empty directory: `cp dt_ctrl/Dockerfile .`
# Tar the source code with `tar czf dt_ctrl.tgz dt_ctrl`
# Create the docker file with `docker build --tag consoledemo .` # Create the docker file with `docker build --tag consoledemo .`
# This Dockerfile is hardcoded to run the websockets server at
# port 8000.
# Start the docker container with
# docker run -it -p 8081:80 -p 8000:8000 -p 11031:11031 -p 11030:11030 -p 11040:11040 -p 11041:11041 -p 11042:11042 -p 11011:11011 consoledemo
# Then visit the consoledemo from the host machine at http://localhost:8081 (NOT at port 8000, which will show a non-working HTML page)
FROM ubuntu:16.04 FROM ubuntu:16.04
RUN apt-get -y update RUN apt-get -y update
...@@ -18,8 +21,7 @@ RUN cd /root/libnova-libnova && libtoolize && autoreconf -i && ./configure && ma ...@@ -18,8 +21,7 @@ RUN cd /root/libnova-libnova && libtoolize && autoreconf -i && ./configure && ma
RUN cd /root && git clone https://github.com/warmcat/libwebsockets.git RUN cd /root && git clone https://github.com/warmcat/libwebsockets.git
RUN cd /root/libwebsockets && mkdir build && cd build && cmake .. && make && make install RUN cd /root/libwebsockets && mkdir build && cd build && cmake .. && make && make install
ADD dt_ctrl.tgz /root RUN cd /root && git clone https://gitlab.camras.nl/dijkema/dt_ctrl
RUN cd /root tar xf dt_ctrl.tgz
RUN cd /root/dt_ctrl && autoconf && ./configure --with-libwebsockets=/usr/local && make RUN cd /root/dt_ctrl && autoconf && ./configure --with-libwebsockets=/usr/local && make
RUN cd /root/dt_ctrl && make console/console/console_httpd RUN cd /root/dt_ctrl && make console/console/console_httpd
...@@ -33,6 +35,45 @@ RUN cp -r /root/dt_ctrl/console/htdocs /var/www/ ...@@ -33,6 +35,45 @@ RUN cp -r /root/dt_ctrl/console/htdocs /var/www/
RUN cp -r /root/dt_ctrl/console/js /var/www/ RUN cp -r /root/dt_ctrl/console/js /var/www/
RUN mkdir -p /var/www/htdocs/tle && touch /var/www/htdocs/tle/amateur.txt && touch /var/www/htdocs/tle/gps-ops.txt && touch /var/www/htdocs/tle/tle-new.txt RUN mkdir -p /var/www/htdocs/tle && touch /var/www/htdocs/tle/amateur.txt && touch /var/www/htdocs/tle/gps-ops.txt && touch /var/www/htdocs/tle/tle-new.txt
CMD screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./start_console.sh' && /bin/bash RUN apt-get -y install apache2 net-tools
RUN mkdir -p /var/www/console/ && cp -r /root/dt_ctrl/console/htdocs /var/www/console && cp -r /root/dt_ctrl/console/js /var/www/console
# Configure apache to serve the console htdocs
RUN echo '\
<VirtualHost *:80>\n\
\tServerAdmin webmaster@localhost\n\
\tDocumentRoot /var/www/console/htdocs\n\
\t<Directory "/var/www/console/htdocs">\n\
\t\tOrder allow,deny\n\
\t\tAllow from all\n\
\t\tAllowOverride None\n\
\t\tAddHandler cgi-script .cgi\n\
\t\tOptions +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n\
\t</Directory>\n\
\n\
ErrorLog ${APACHE_LOG_DIR}/error.log\n\
CustomLog ${APACHE_LOG_DIR}/access.log combined\n\
</VirtualHost>\n\
' > /etc/apache2/sites-enabled/000-default.conf
# Configure ports for the console and controller
RUN mkdir /etc/dt && echo '\
[console]\n\
host=localhost\n\
\n\
[controller]\n\
host=localhost\n\
\n\
[htdocs]\n\
path=/var/www/console/htdocs\n\
port=8000\n\
' > /etc/dt/dt_host.ini
# Patch the console software to point the websockets port
RUN sed -i -e 's/window.location.host/window.location.hostname+":8000"/' /var/www/console/htdocs/index.html && \
sed -i -e 's/window.location.host/window.location.hostname+":8000"/' /var/www/console/htdocs/mech.html
CMD screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./start_console.sh' && /bin/bash -c 'service apache2 start' && bash
EXPOSE 80 EXPOSE 80
...@@ -136,7 +136,11 @@ void a2coord(char *ara, char *adec, struct ln_hms *ra, struct ln_dms *dec) ...@@ -136,7 +136,11 @@ void a2coord(char *ara, char *adec, struct ln_hms *ra, struct ln_dms *dec)
i = 1; i = 1;
} else { } else {
dec->neg = 0; dec->neg = 0;
i = 0; if (strlen(adec) && adec[0] =='+') {
i = 1;
} else {
i = 0;
}
} }
dec->degrees = 0; dec->degrees = 0;
dec->minutes = 0; dec->minutes = 0;
......
...@@ -24,6 +24,7 @@ screen -S console -X screen -t console_sattracker console_sattracker ...@@ -24,6 +24,7 @@ screen -S console -X screen -t console_sattracker console_sattracker
screen -S console -X screen -t console_weather console_weather screen -S console -X screen -t console_weather console_weather
screen -S console -X screen -t console_httpd console_httpd screen -S console -X screen -t console_httpd console_httpd
screen -S console -X screen -t console_trace2port ../../common/trace/trace2port -d localhost Azimuth_Position Elevation_Position azimuth_setpoint_error.difference elevation_setpoint_error.difference Azimuth_Speed Elevation_Speed_Right Focusbox_Position
screen -S console -X screen -t trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Position /var/log/dt/traces/Azimuth_Position.trace 15000 100000 5 screen -S console -X screen -t trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Position /var/log/dt/traces/Azimuth_Position.trace 15000 100000 5
screen -S console -X screen -t trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Position /var/log/dt/traces/Elevation_Position.trace 15000 100000 5 screen -S console -X screen -t trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Position /var/log/dt/traces/Elevation_Position.trace 15000 100000 5
......
...@@ -289,19 +289,23 @@ function dt_status(element_name) { ...@@ -289,19 +289,23 @@ function dt_status(element_name) {
this.fb_plus_command = new controller_command("focusbox_plus", "bool"); this.fb_plus_command = new controller_command("focusbox_plus", "bool");
this.fb_min_command = new controller_command("focusbox_min", "bool"); this.fb_min_command = new controller_command("focusbox_min", "bool");
this.button_fb_p.onmousedown = function() { this.button_fb_p.element.addEventListener("mousedown", function() {
dt_status_this.fb_plus_command.send(1); dt_status_this.fb_plus_command.send(1);
} });
this.button_fb_p.onmouseup = function() { function fb_p_disable(e) {
dt_status_this.fb_plus_command.send(0); dt_status_this.fb_plus_command.send(0);
} }
this.button_fb_p.element.addEventListener("mouseup", fb_p_disable);
this.button_fb_p.element.addEventListener("mouseout", fb_p_disable);
this.button_fb_m.onmousedown = function() { this.button_fb_m.element.addEventListener("mousedown", function() {
dt_status_this.fb_min_command.send(1); dt_status_this.fb_min_command.send(1);
} });
this.button_fb_m.onmouseup = function() { function fb_m_disable(e) {
dt_status_this.fb_min_command.send(0); dt_status_this.fb_min_command.send(0);
} }
this.button_fb_m.element.addEventListener("mouseup", fb_m_disable);
this.button_fb_m.element.addEventListener("mouseout", fb_m_disable);
} }
......
...@@ -142,17 +142,31 @@ function offset(element_name) { ...@@ -142,17 +142,31 @@ function offset(element_name) {
*/ */
this.highlight_title = function(az, el)
{
if (az!=0 || el!=0)
{
this.window.title.element.style.background = 'yellow';
}
else
{
this.window.title.element.style.background = 'silver';
}
}
this.set_offset = function(az, el) this.set_offset = function(az, el)
{ {
this.val_az.value_set(decimals(rad2deg(az), 4)); this.val_az.value_set(decimals(rad2deg(az), 4));
this.val_el.value_set(decimals(rad2deg(el), 4)); this.val_el.value_set(decimals(rad2deg(el), 4));
this.highlight_title(az, el);
} }
this.send = function(az, el) this.send = function(az, el)
{ {
az = deg2rad(floatval(az)); az = deg2rad(floatval(az));
el = deg2rad(floatval(el)); el = deg2rad(floatval(el));
this.highlight_title(az, el);
dt_websocket_send("command offset" + " " + az + " " + el); dt_websocket_send("command offset" + " " + az + " " + el);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment