Merge pull request #101 from rickcarlino/master

Remove old control panel
pull/102/head
Rick Carlino 2014-08-08 05:08:24 -07:00
commit b266b13de2
10 changed files with 211 additions and 219 deletions

View File

@ -1,71 +0,0 @@
# The movement controller provides an indepth view of a device as well as fine-
# grained control options. The name is an artifact and needs to be changed.
# TODO: Network status indicator
# TODO: Device selection
# Run this in the command line for diagnostics.
# ======
# curl -X GET http://skynet.im/subscribe/713c69b1-e36a-11e3-93f8-f3e7e8d1cce9?token=0waw1l97lbwc23xrh0oem7d8rbai3sor --header "skynet_auth_uuid: 4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9" --header "skynet_auth_token: jce90gf7szxxyldihii1m3xv5d9jatt9"
angular.module('FarmBot').controller "Movement2Controller", [
'$scope'
'Restangular'
'Devices'
($scope, Restangular, Devices) ->
$scope.devices = Devices
$scope.x = 0
$scope.y = 0
$scope.z = 0
$scope.moveTo = ({x, y, z}) ->
# These will probably get out of sync at some point. Will need to find a
# way to refresh based on what the device tells us about its location.
$scope.x += x if x
$scope.y += y if y
$scope.z += z if z
console.log("Movings to #{$scope.x}, #{$scope.y}, #{$scope.z}")
$scope.goAbs()
$scope.goHome = ->
$scope.devices.connection.message
devices: $scope.devices.current.uuid
payload:
message_type: 'single_command'
time_stamp: new Date()
command:
action: 'MOVE ABSOLUTE'
x: 0
y: 0
z: 0
speed: 100 # Not sure about this one.
amount: 0 # Is this for "DOSE WATER"?
delay: 0
, (data) ->
console.log("Done moving home")
$scope.devices.log << data
console.log data
return true
$scope.goAbs = ->
$scope.devices.connection.message
devices: $scope.devices.current.uuid
payload:
message_type: 'single_command'
time_stamp: new Date()
command:
action: 'MOVE ABSOLUTE'
x: $scope.x
y: $scope.y
z: $scope.z
speed: 100 # Not sure about this one.
amount: 0 # Is this for "DOSE WATER"?
delay: 0
, (data) ->
console.log("Done attempting movement to #{$scope.x}, #{$scope.y}, #{$scope.z}")
$scope.devices.log << data
console.log data
return true
$scope.debug = ->
$scope.devices.connection.emit "message", JSON.parse($scope.message), (data) ->
console.log data
]

View File

@ -5,34 +5,29 @@
# Run this in the command line for diagnostics.
# ======
# curl -X GET http://skynet.im/subscribe/713c69b1-e36a-11e3-93f8-f3e7e8d1cce9?token=0waw1l97lbwc23xrh0oem7d8rbai3sor --header "skynet_auth_uuid: 4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9" --header "skynet_auth_token: jce90gf7szxxyldihii1m3xv5d9jatt9"
angular.module('FarmBot').controller "MovementController", [
angular.module('FarmBot').controller "Movement2Controller", [
'$scope'
'Restangular'
($scope, Restangular) ->
'Devices'
($scope, Restangular, Devices) ->
$scope.devices = Devices
$scope.x = 0
$scope.y = 0
$scope.z = 0
$scope.upx = ->
$scope.x = $scope.x + 5
$scope.upy = ->
$scope.y = $scope.y + 5
$scope.upz = ->
$scope.z = $scope.z + 5
$scope.downx = ->
$scope.x = $scope.x - 5
$scope.downy = ->
$scope.y = $scope.y - 5
$scope.downz = ->
$scope.z = $scope.z - 5
Restangular.all('devices').getList().then (data) ->
$scope.devices = data
$scope.device = data[0]
$scope.connectToSkyNet()
$scope.moveTo = ({x, y, z}) ->
# These will probably get out of sync at some point. Will need to find a
# way to refresh based on what the device tells us about its location.
$scope.x += x if x
$scope.y += y if y
$scope.z += z if z
console.log("Movings to #{$scope.x}, #{$scope.y}, #{$scope.z}")
$scope.goAbs()
$scope.goHome = ->
$scope.socket.message
devices: $scope.device.uuid
$scope.devices.connection.message
devices: $scope.devices.current.uuid
payload:
message_type: 'single_command'
time_stamp: new Date()
@ -45,12 +40,14 @@ angular.module('FarmBot').controller "MovementController", [
amount: 0 # Is this for "DOSE WATER"?
delay: 0
, (data) ->
console.log("Done moving home")
$scope.devices.log << data
console.log data
return true
$scope.goAbs = ->
$scope.socket.message
devices: $scope.device.uuid
$scope.devices.connection.message
devices: $scope.devices.current.uuid
payload:
message_type: 'single_command'
time_stamp: new Date()
@ -63,26 +60,12 @@ angular.module('FarmBot').controller "MovementController", [
amount: 0 # Is this for "DOSE WATER"?
delay: 0
, (data) ->
console.log("Done attempting movement to #{$scope.x}, #{$scope.y}, #{$scope.z}")
$scope.devices.log << data
console.log data
return true
$scope.connectToSkyNet = ->
config =
type: "farmbotdss"
uuid: "901ba251-ed7a-11e3-995a-b7667747c514"
token: "32pwbkzd7qp06bt9zznee5xjhc7kfbt9"
$scope.socket = skynet.createConnection(config)
$scope.socket.on "ready", (data) ->
console.log "Ready"
$scope.socket.on "message", (data) ->
#TODO: Append all incoming messages to an array for
# display / unit tests.
console.log data
$scope.socket.status (data) ->
console.log data
$scope.debug = ->
$scope.socket.emit "message", JSON.parse($scope.message), (data) ->
$scope.devices.connection.emit "message", JSON.parse($scope.message), (data) ->
console.log data
]

View File

@ -0,0 +1,88 @@
# # The movement controller provides an indepth view of a device as well as fine-
# # grained control options. The name is an artifact and needs to be changed.
# # TODO: Network status indicator
# # TODO: Device selection
# # Run this in the command line for diagnostics.
# # ======
# # curl -X GET http://skynet.im/subscribe/713c69b1-e36a-11e3-93f8-f3e7e8d1cce9?token=0waw1l97lbwc23xrh0oem7d8rbai3sor --header "skynet_auth_uuid: 4bb4a961-e8e6-11e3-93f8-f3e7e8d1cce9" --header "skynet_auth_token: jce90gf7szxxyldihii1m3xv5d9jatt9"
# angular.module('FarmBot').controller "MovementController", [
# '$scope'
# 'Restangular'
# ($scope, Restangular) ->
# $scope.x = 0
# $scope.y = 0
# $scope.z = 0
# $scope.upx = ->
# $scope.x = $scope.x + 5
# $scope.upy = ->
# $scope.y = $scope.y + 5
# $scope.upz = ->
# $scope.z = $scope.z + 5
# $scope.downx = ->
# $scope.x = $scope.x - 5
# $scope.downy = ->
# $scope.y = $scope.y - 5
# $scope.downz = ->
# $scope.z = $scope.z - 5
# Restangular.all('devices').getList().then (data) ->
# $scope.devices = data
# $scope.device = data[0]
# $scope.connectToSkyNet()
# $scope.goHome = ->
# $scope.socket.message
# devices: $scope.device.uuid
# payload:
# message_type: 'single_command'
# time_stamp: new Date()
# command:
# action: 'MOVE ABSOLUTE'
# x: 0
# y: 0
# z: 0
# speed: 100 # Not sure about this one.
# amount: 0 # Is this for "DOSE WATER"?
# delay: 0
# , (data) ->
# console.log data
# return true
# $scope.goAbs = ->
# $scope.socket.message
# devices: $scope.device.uuid
# payload:
# message_type: 'single_command'
# time_stamp: new Date()
# command:
# action: 'MOVE ABSOLUTE'
# x: $scope.x
# y: $scope.y
# z: $scope.z
# speed: 100 # Not sure about this one.
# amount: 0 # Is this for "DOSE WATER"?
# delay: 0
# , (data) ->
# console.log data
# return true
# $scope.connectToSkyNet = ->
# config =
# type: "farmbotdss"
# uuid: "901ba251-ed7a-11e3-995a-b7667747c514"
# token: "32pwbkzd7qp06bt9zznee5xjhc7kfbt9"
# $scope.socket = skynet.createConnection(config)
# $scope.socket.on "ready", (data) ->
# console.log "Ready"
# $scope.socket.on "message", (data) ->
# #TODO: Append all incoming messages to an array for
# # display / unit tests.
# console.log data
# $scope.socket.status (data) ->
# console.log data
# $scope.debug = ->
# $scope.socket.emit "message", JSON.parse($scope.message), (data) ->
# console.log data
# ]

View File

@ -25,8 +25,5 @@ app.config [
).when("/movement",
templateUrl: "movement.html"
controller: "MovementController"
).when("/movement2",
templateUrl: "movement2.html"
controller: "Movement2Controller"
).otherwise redirectTo: "/main"
]

View File

@ -3,8 +3,6 @@
// includes them here.
%script{:id => "movement.html", :type => "text/ng-template"}
= render partial: "dashboard/ng-partials/movement"
%script{:id => "movement2.html", :type => "text/ng-template"}
= render partial: "dashboard/ng-partials/movement2"
%script{:id => "settings.html", :type => "text/ng-template"}
= render partial: "dashboard/ng-partials/settings"
%script{:id => "main.html", :type => "text/ng-template"}

View File

@ -19,7 +19,8 @@
<path ng-click="moveTo({x: 10, y: 10})" id="up-right-10" fill="#93c47d" d="m156.50272 89.424255l42.23622 -42.23622l-8.724411 -8.724407l34.897644 0l0 34.89764l-8.724411 -8.724411l-42.23622 42.23622z" fill-rule="nonzero"/>
<path ng-click="moveTo({x: 100, y: 100})" id="up-right-100" fill="#6aa84f" d="m176.42484 69.50218l22.330704 -22.330711l-8.724411 -8.724407l34.897644 0l0 34.897633l-8.724411 -8.724403l-22.330704 22.330704z" fill-rule="nonzero"/>
<!-- end up right -->
<path fill="#b6d7a8" d="m112.339775 130.05183l0 0c0 -10.62822 8.615875 -19.244095 19.244087 -19.244095l0 0c5.1038513 0 9.9986725 2.0274963 13.6076355 5.636467c3.608963 3.608963 5.6364594 8.503777 5.6364594 13.607628l0 0c0 10.62822 -8.615875 19.244095 -19.244095 19.244095l0 0c-10.628212 0 -19.244087 -8.615875 -19.244087 -19.244095z" fill-rule="nonzero"/>
<!-- GOTO home -->
<path ng-click="goHome()" fill="#b6d7a8" d="m112.339775 130.05183l0 0c0 -10.62822 8.615875 -19.244095 19.244087 -19.244095l0 0c5.1038513 0 9.9986725 2.0274963 13.6076355 5.636467c3.608963 3.608963 5.6364594 8.503777 5.6364594 13.607628l0 0c0 10.62822 -8.615875 19.244095 -19.244095 19.244095l0 0c-10.628212 0 -19.244087 -8.615875 -19.244087 -19.244095z" fill-rule="nonzero"/>
<!-- up left controls -->
<path ng-click="moveTo({x: -1, y: 1})" id="up-left-1" fill="#b6d7a8" d="m109.82971 126.403404l-61.763775 -61.76378l-8.724411 8.724411l0 -34.89764l34.89764 0l-8.724411 8.724411l61.76378 61.763775z" fill-rule="nonzero"/>
<path ng-click="moveTo({x: -10, y: 10})" id="up-left-10" fill="#93c47d" d="m90.31523 106.88894l-42.236217 -42.23622l-8.724411 8.724411l0 -34.89764l34.89764 0l-8.724411 8.724411l42.23622 42.236217z" fill-rule="nonzero"/>

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,46 +1,63 @@
.row
%h1 Manual Device Control
.large-10.columns
%ul{'ng-repeat' => 'device in new_devices.list'}
%li {{device.name}}
.row
.large-8.columns
.large-6.columns
= render partial: "dashboard/ng-partials/control_star"
.large-6.columns
.panel
.container.clearfix
.large-4.columns Gantry (X)
.large-4.columns
%span.label.round.success{ng_click: 'upx()'}
%i.fi-plus
{{ x }}
%span.label.round.alert{ng_click: 'downx()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
.large-3.columns
%h5 Axis
.large-3.columns
%h5 Current Position (m1)
.large-3.columns
%h5 Enter New Position (m)
.large-3.columns
%h5 Home
%br
.container.clearfix
.large-4.columns Cross-Slide (Y)
.large-4.columns
%span.label.round.success{ng_click: 'upy()'}
%i.fi-plus
{{ y }}
%span.label.round.alert{ng_click: 'downy()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
.large-3.columns Gantry (X)
.large-3.columns 10.2
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
X
%br
.container.clearfix
.large-4.columns Tool Mount (Z)
.large-4.columns
%span.label.round.success{ng_click: 'upz()'}
%i.fi-plus
{{ z }}
%span.label.round.alert{ng_click: 'downz()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
%br/
%ul.button-group.even-3
%li
%a.button.small{href: "", 'ng-click' => 'goHome()'} Jog to Home
%li
%a.button.small{href: "", ng_click: 'goAbs()'} Move!
%li
%a.button.small.alert{href: "#"} Shutdown
.large-3.columns Cross-Slide (Y)
.large-3.columns 4.6
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
Y
%br
.container.clearfix
.large-3.columns Tool Slide (Z)
.large-3.columns 3.14
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
Z
%br
.container.clearfix
.large-3.columns.clearfix
%br
.large-3.columns.clearfix
%br
.large-3.columns
%button.button.tiny
Home
.large-3.columns
%button.button.tiny
All
.row
.large-12.columns
%iframe{frameborder: "0", scrolling: "no", src: "http://75.128.5.101:8081/", style: "border: 0px none transparent;", width: '100%', height: '640'}
.row
.large-3.columns
.large-6.columns
@ -48,7 +65,4 @@
%form{ng_submit: 'debug()'}
%input{type: "text", name: "fname", ng_model: 'message'}
%input.button{name: "commit", type: "submit", value: "Send"}
.large-3.columns
.row
.large-6.columns
%iframe{frameborder: "0", height: "234", scrolling: "no", src: "http://75.128.5.101:8081/", style: "border: 0px none transparent;", width: "800", height: "600"}
.large-3.columns

View File

@ -1,57 +0,0 @@
.row
.large-10.columns
%ul{'ng-repeat' => 'device in new_devices.list'}
%li {{device.name}}
.row
.large-6.columns
= render partial: "dashboard/ng-partials/control_star"
.large-6.columns
.panel
.container.clearfix
.large-3.columns
%h5 Axis
.large-3.columns
%h5 Current Position (m1)
.large-3.columns
%h5 Enter New Position (m)
.large-3.columns
%h5 Home
%br
.container.clearfix
.large-3.columns Gantry (X)
.large-3.columns 10.2
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
X
%br
.container.clearfix
.large-3.columns Cross-Slide (Y)
.large-3.columns 4.6
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
Y
%br
.container.clearfix
.large-3.columns Tool Slide (Z)
.large-3.columns 3.14
.large-3.columns
%input.tiny-input{type: "number"}
.large-3.columns
%button.button.tiny
Z
%br
.container.clearfix
.large-3.columns.clearfix
%br
.large-3.columns.clearfix
%br
.large-3.columns
%button.button.tiny
Home
.large-3.columns
%button.button.tiny
All

View File

@ -0,0 +1,43 @@
.row
%h1 Manual Device Control
.row
.large-8.columns
.panel
.container.clearfix
.large-4.columns Gantry (X)
.large-4.columns
%span.label.round.success{ng_click: 'upx()'}
%i.fi-plus
{{ x }}
%span.label.round.alert{ng_click: 'downx()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
.container.clearfix
.large-4.columns Cross-Slide (Y)
.large-4.columns
%span.label.round.success{ng_click: 'upy()'}
%i.fi-plus
{{ y }}
%span.label.round.alert{ng_click: 'downy()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
.container.clearfix
.large-4.columns Tool Mount (Z)
.large-4.columns
%span.label.round.success{ng_click: 'upz()'}
%i.fi-plus
{{ z }}
%span.label.round.alert{ng_click: 'downz()'}
%i.fi-minus
.large-4.columns Jog to:
%br/
%br/
%ul.button-group.even-3
%li
%a.button.small{href: "", 'ng-click' => 'goHome()'} Jog to Home
%li
%a.button.small{href: "", ng_click: 'goAbs()'} Move!
%li
%a.button.small.alert{href: "#"} Shutdown

View File

@ -28,12 +28,8 @@
-if current_user
%li{class: ("active" if current_page? page_path('#/settings'))}
= link_to 'Control', '/dashboard#/movement'
// TODO: Add CSS rule based on hash fragment?
%li{class: ("active" if current_page? page_path('#/settings'))}
= link_to 'New Control', '/dashboard#/movement2'
// TODO: Add CSS rule based on hash fragment?
%li{class: ("active" if current_page? page_path('#/settings'))}
= link_to 'Settings', '/dashboard#/settings'
= link_to 'Devices', '/dashboard#/settings'
%li{class: ("active" if current_page? page_path('help'))}
= link_to 'Help', page_path('help')
%ul.right