Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rndmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jake Read
rndmc
Commits
3a9e50d2
Commit
3a9e50d2
authored
6 years ago
by
Jake Read
Browse files
Options
Downloads
Patches
Plain Diff
fix bug where not asserting OG module name / id on load from file
parent
404c91f4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+4
-0
4 additions, 0 deletions
README.md
programs.js
+37
-25
37 additions, 25 deletions
programs.js
programs/dmz.json
+0
-30
0 additions, 30 deletions
programs/dmz.json
with
41 additions
and
55 deletions
README.md
+
4
−
0
View file @
3a9e50d2
...
@@ -15,6 +15,10 @@ This project serves the developement environment / api we use to write and repre
...
@@ -15,6 +15,10 @@ This project serves the developement environment / api we use to write and repre
## For MW
## For MW
-
change /src to /modules or /units ?
-
bug is -num modules on load
-
walk program units and change
-
walk program units and change
-
rename inout to jsunit
-
rename inout to jsunit
-
buttons get onClick evt
-
buttons get onClick evt
...
...
This diff is collapsed.
Click to expand it.
programs.js
+
37
−
25
View file @
3a9e50d2
...
@@ -5,7 +5,7 @@ const Reps = require('./reps.js')
...
@@ -5,7 +5,7 @@ const Reps = require('./reps.js')
const
JSUnit
=
require
(
'
./lib/jsunit.js
'
)
const
JSUnit
=
require
(
'
./lib/jsunit.js
'
)
let
isStateKey
=
JSUnit
.
isStateKey
let
isStateKey
=
JSUnit
.
isStateKey
function
loadModuleFromSource
(
program
,
path
)
{
function
loadModuleFromSource
(
program
,
path
,
id
)
{
// source -> heap
// source -> heap
if
(
fs
.
existsSync
(
path
))
{
if
(
fs
.
existsSync
(
path
))
{
var
src
=
require
(
path
)
var
src
=
require
(
path
)
...
@@ -19,7 +19,11 @@ function loadModuleFromSource(program, path) {
...
@@ -19,7 +19,11 @@ function loadModuleFromSource(program, path) {
}
}
// make unique name
// make unique name
if
(
id
)
{
mod
.
description
.
id
=
id
}
else
{
mod
.
description
.
id
=
mod
.
description
.
name
+
'
-
'
+
program
.
description
.
counter
mod
.
description
.
id
=
mod
.
description
.
name
+
'
-
'
+
program
.
description
.
counter
}
mod
.
description
.
path
=
path
mod
.
description
.
path
=
path
// add to program object
// add to program object
...
@@ -161,7 +165,7 @@ function openProgram(path){
...
@@ -161,7 +165,7 @@ function openProgram(path){
for
(
key
in
prgRep
.
modules
)
{
for
(
key
in
prgRep
.
modules
)
{
var
mdlRep
=
prgRep
.
modules
[
key
]
var
mdlRep
=
prgRep
.
modules
[
key
]
loadModuleFromSource
(
program
,
mdlRep
.
description
.
path
)
loadModuleFromSource
(
program
,
mdlRep
.
description
.
path
,
mdlRep
.
description
.
id
)
}
}
// restore saved state and links
// restore saved state and links
...
@@ -173,6 +177,12 @@ function openProgram(path){
...
@@ -173,6 +177,12 @@ function openProgram(path){
// this is the actual object, having functions and whatnot
// this is the actual object, having functions and whatnot
var
mdl
=
program
.
modules
[
modName
]
var
mdl
=
program
.
modules
[
modName
]
if
(
mdl
==
null
)
{
console
.
log
(
'
NULL
'
)
console
.
log
(
'
prgRep modules
'
,
prgRep
.
modules
)
console
.
log
(
'
program modules
'
,
program
.
modules
)
}
// hooking outputs -> inputs
// hooking outputs -> inputs
for
(
outName
in
mdlRep
.
outputs
)
{
for
(
outName
in
mdlRep
.
outputs
)
{
var
outRep
=
mdlRep
.
outputs
[
outName
]
var
outRep
=
mdlRep
.
outputs
[
outName
]
...
@@ -197,6 +207,8 @@ function openProgram(path){
...
@@ -197,6 +207,8 @@ function openProgram(path){
}
}
}
}
console
.
log
(
'
mdlRep
'
,
mdlRep
)
console
.
log
(
'
mdl
'
,
mdl
)
// restore position / UI state
// restore position / UI state
if
(
mdlRep
.
description
.
position
!=
null
)
{
if
(
mdlRep
.
description
.
position
!=
null
)
{
// ??
// ??
...
...
This diff is collapsed.
Click to expand it.
programs/dmz.json
+
0
−
30
View file @
3a9e50d2
...
@@ -97,36 +97,6 @@
...
@@ -97,36 +97,6 @@
"message"
:
"---"
"message"
:
"---"
}
}
},
},
"Breadboard Servo Signal Generator-6"
:
{
"description"
:
{
"id"
:
"Breadboard Servo Signal Generator-6"
,
"name"
:
"Breadboard Servo Signal Generator"
,
"alt"
:
"servo"
,
"path"
:
"./src/hardware/servo.js"
,
"position"
:
{
"left"
:
583
,
"top"
:
632
}
},
"inputs"
:
{
"packet"
:
{
"accepts"
:
"headless packet"
}
},
"outputs"
:
{
"packet"
:
{
"emits"
:
"number"
,
"calls"
:
[]
}
},
"state"
:
{
"button"
:
{
"type"
:
"button"
,
"label"
:
"SEND"
},
"servoVal"
:
0
}
},
"delay-7"
:
{
"delay-7"
:
{
"description"
:
{
"description"
:
{
"id"
:
"delay-7"
,
"id"
:
"delay-7"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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