Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Atelier IGB Apollo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pôle Jeune
Atelier IGB Apollo
Commits
66c6020a
Commit
66c6020a
authored
4 years ago
by
antoinekia
Browse files
Options
Downloads
Patches
Plain Diff
reed captors interractions
parent
e37e1d54
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#18
passed with stage
Stage:
in 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/activity_1/main-script.js
+38
-3
38 additions, 3 deletions
public/activity_1/main-script.js
with
38 additions
and
3 deletions
public/activity_1/main-script.js
+
38
−
3
View file @
66c6020a
/* Insérer ici les fonctions spécifiques à cette activité. Elles peuvent marcher
avec les fonctions et variables déjà définies dans 'activity_functions.js' du
dossier 'res'.*/
var
reedStatus
;
var
reedsStatus
=
null
;
var
catchedFull
=
{
LH2
:
false
,
LOX2
:
false
,
RP1
:
false
,
LOX1
:
false
}
var
catchTime
=
{
LH2
:
-
1
,
LOX2
:
-
1
,
RP1
:
-
1
,
LOX1
:
-
1
}
var
checkReedsInterval
=
setInterval
(
function
()
{
if
(
receivedMsg
.
startsWith
(
'
REEDS
'
))
{
reedsStatus
=
JSON
.
parse
(
receivedMsg
.
split
(
'
_
'
)[
1
])
console
.
log
(
reedsStatus
)
//console.log(reedsStatus)
for
(
var
key
of
Object
.
keys
(
reedsStatus
))
{
if
(
reedsStatus
[
key
]
&&
catchTime
[
key
]
==
-
1
)
{
catchTime
[
key
]
=
Date
.
now
()
console
.
log
(
"
Catch tank plein de
"
,
key
)
}
}
}
for
(
var
key
of
Object
.
keys
(
catchedFull
))
{
if
(
catchTime
[
key
]
!=
-
1
&&
!
catchedFull
[
key
])
{
if
(
Date
.
now
()
-
catchTime
[
key
]
>
3000
)
{
catchedFull
[
key
]
=
true
alert
(
"
Aie aie aie ! Débordement non maitrisé !
"
)
}
}
}
},
250
);
function
init_var
()
{
catchedFull
=
{
LH2
:
false
,
LOX2
:
false
,
RP1
:
false
,
LOX1
:
false
}
catchTime
=
{
LH2
:
-
1
,
LOX2
:
-
1
,
RP1
:
-
1
,
LOX1
:
-
1
}
reedsStatus
=
null
}
function
isTankFull
(
tankId
)
{
if
(
reedsStatus
==
null
)
return
false
if
(
reedsStatus
[
tankId
])
{
return
true
;
}
}
function
stopLoading
(
tankId
)
{
if
(
reedsStatus
[
tankId
])
{
catchedFull
[
tankId
]
=
true
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment