Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
catlaser
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chris Prince
catlaser
Commits
6e352ac4
Commit
6e352ac4
authored
Apr 24, 2021
by
Chris Prince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Just cleanup of the interface
parent
e83ae163
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
14 deletions
+36
-14
app.component.css
website/lasercat-ui/src/app/app.component.css
+6
-1
app.component.html
website/lasercat-ui/src/app/app.component.html
+8
-8
app.component.ts
website/lasercat-ui/src/app/app.component.ts
+20
-2
app.module.ts
website/lasercat-ui/src/app/app.module.ts
+0
-1
esp12.service.ts
website/lasercat-ui/src/app/services/esp12.service.ts
+2
-2
No files found.
website/lasercat-ui/src/app/app.component.css
View file @
6e352ac4
...
@@ -10,6 +10,10 @@
...
@@ -10,6 +10,10 @@
margin-left
:
5px
;
margin-left
:
5px
;
}
}
.centered
{
.centered
{
margin
:
auto
;
text-align
:
center
;
margin
:
1em
auto
;
width
:
50%
;
width
:
50%
;
}
.btn
{
margin
:
auto
1em
;
}
}
\ No newline at end of file
website/lasercat-ui/src/app/app.component.html
View file @
6e352ac4
...
@@ -6,21 +6,21 @@
...
@@ -6,21 +6,21 @@
<img
width=
"500"
alt=
"laser cat xkcd"
src=
"https://imgs.xkcd.com/comics/laser_pointer.png"
>
<img
width=
"500"
alt=
"laser cat xkcd"
src=
"https://imgs.xkcd.com/comics/laser_pointer.png"
>
</div>
</div>
<div
class=
"centered"
>
<div
class=
"centered"
>
<div
class=
"btn-
group
"
>
<div
class=
"btn-
block
"
>
<button
(
click
)="
triggerLaser
()"
class=
"btn"
[
ngClass
]="{
'
btn-outline-danger
'
:
laserState =
==
'
on
',
'
btn-outline-info
'
:
laserState =
==
'
off
'}"
>
Turn {{ laserState }} Laser
</button>
<button
(
click
)="
triggerLaser
()"
class=
"btn"
[
ngClass
]="{
'
btn-outline-danger
'
:
laserState =
==
'
on
',
'
btn-outline-info
'
:
laserState =
==
'
off
'}"
>
Turn {{ laserState }} Laser
</button>
<button
class=
"btn btn-warning"
>
Start Random Patterns
</button>
<button
class=
"btn btn-warning"
[
disabled
]="
randomRuns
"
>
Start Random Patterns
</button>
</div>
</div>
<div
class=
"btn-
group
"
>
<div
class=
"btn-
block
"
>
<div
class=
"inline"
>
<div
class=
"inline"
>
<div
class=
"pos"
>
<div
class=
"pos"
>
<label
for=
"xPos"
>
X:
</label>
<label
for=
"xPos"
>
<strong>
X
</strong>
:
</label>
<input
class=
"mini"
maxlength=
"3"
id=
"xPos"
type=
"number"
min=
"0"
max=
"180"
/>
<input
class=
"mini"
maxlength=
"3"
id=
"xPos"
type=
"number"
min=
"0"
max=
"180"
[
formControl
]="
xCtrl
"
/>
</div>
</div>
<div
class=
"pos"
>
<div
class=
"pos"
>
<label
for=
"yPos"
>
Y:
</label>
<label
for=
"yPos"
>
<strong>
Y
</strong>
:
</label>
<input
class=
"mini"
maxlength=
"3"
id=
"yPos"
type=
"number"
min=
"0"
max=
"180"
/>
<input
class=
"mini"
maxlength=
"3"
id=
"yPos"
type=
"number"
min=
"0"
max=
"180"
[
formControl
]="
yCtrl
"
/>
</div>
</div>
<button
class=
"btn btn-sm btn-
link
"
(
click
)="
moveLaser
()"
>
Move
</button>
<button
class=
"btn btn-sm btn-
outline-info
"
(
click
)="
moveLaser
()"
>
Move
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
website/lasercat-ui/src/app/app.component.ts
View file @
6e352ac4
import
{
Component
}
from
'@angular/core'
;
import
{
Component
}
from
'@angular/core'
;
import
{
Router
}
from
'@angular/router
'
;
import
{
FormControl
,
FormGroup
}
from
'@angular/forms
'
;
import
{
Esp12Service
}
from
'./services/esp12.service'
;
import
{
Esp12Service
}
from
'./services/esp12.service'
;
@
Component
({
@
Component
({
...
@@ -10,23 +10,41 @@ import { Esp12Service } from './services/esp12.service';
...
@@ -10,23 +10,41 @@ import { Esp12Service } from './services/esp12.service';
export
class
AppComponent
{
export
class
AppComponent
{
title
=
'lasercat-ui'
;
title
=
'lasercat-ui'
;
laserState
=
'on'
;
laserState
=
'on'
;
randomRuns
:
boolean
;
xCtrl
:
FormControl
;
yCtrl
:
FormControl
;
protected
form
:
FormGroup
;
constructor
(
private
esp
:
Esp12Service
)
{}
constructor
(
private
esp
:
Esp12Service
)
{}
ngOnInit
()
{
this
.
form
=
new
FormGroup
({
xPosition
:
new
FormControl
(
''
),
yPosition
:
new
FormControl
(
''
)
});
this
.
xCtrl
=
this
.
form
.
get
(
'xPosition'
)
as
FormControl
;
this
.
yCtrl
=
this
.
form
.
get
(
'yPosition'
)
as
FormControl
;
}
public
triggerLaser
()
{
public
triggerLaser
()
{
if
(
this
.
laserState
===
'on'
)
{
if
(
this
.
laserState
===
'on'
)
{
this
.
esp
.
start
().
subscribe
();
this
.
esp
.
start
().
subscribe
();
}
else
{
}
else
{
this
.
esp
.
stop
().
subscribe
();
this
.
esp
.
stop
().
subscribe
();
this
.
randomRuns
=
false
;
}
}
this
.
laserState
=
this
.
laserState
===
'on'
?
'off'
:
'on'
;
// value is inversed;
this
.
laserState
=
this
.
laserState
===
'on'
?
'off'
:
'on'
;
// value is inversed;
}
}
public
moveLaser
()
{
public
moveLaser
()
{
this
.
esp
.
move
(
100
,
100
);
const
xy
=
this
.
form
.
value
;
this
.
esp
.
move
(
xy
.
xPosition
,
xy
.
yPosition
);
}
}
public
randomizeLaser
()
{
public
randomizeLaser
()
{
this
.
laserState
=
'off'
;
this
.
randomRuns
=
true
;
this
.
esp
.
random
().
subscribe
();
this
.
esp
.
random
().
subscribe
();
}
}
}
}
website/lasercat-ui/src/app/app.module.ts
View file @
6e352ac4
...
@@ -16,7 +16,6 @@ import { HttpClientModule } from '@angular/common/http';
...
@@ -16,7 +16,6 @@ import { HttpClientModule } from '@angular/common/http';
FormsModule
,
FormsModule
,
HttpClientModule
,
HttpClientModule
,
ReactiveFormsModule
,
ReactiveFormsModule
,
],
],
providers
:
[],
providers
:
[],
bootstrap
:
[
AppComponent
]
bootstrap
:
[
AppComponent
]
...
...
website/lasercat-ui/src/app/services/esp12.service.ts
View file @
6e352ac4
...
@@ -10,8 +10,8 @@ export class Esp12Service {
...
@@ -10,8 +10,8 @@ export class Esp12Service {
constructor
(
private
httpCli
:
HttpClient
)
{
}
constructor
(
private
httpCli
:
HttpClient
)
{
}
move
(
x
:
number
,
y
:
number
):
Observable
<
any
>
{
move
(
x
:
string
,
y
:
string
):
Observable
<
any
>
{
return
this
.
httpCli
.
get
(
`/move
?x=
${
x
}
&y=
${
y
}
`
);
return
this
.
httpCli
.
get
(
`/move
`
,
{
params
:
{
x
,
y
}}
);
}
}
random
():
Observable
<
any
>
{
random
():
Observable
<
any
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment