Skip to content

Commit dbd219e

Browse files
committed
add GT for hints & gcodes documentation
1 parent 062d78d commit dbd219e

File tree

10 files changed

+213
-14
lines changed

10 files changed

+213
-14
lines changed

app/hints.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ var marked = require('marked');
44
var hljs=require('highlight.js');
55
var path= require('path');
66
var http = require('https');
7+
var gtBanner = '';
8+
var hlBanner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
9+
var srBanner='<script src="js/head.min.js"></script><script>head.load("js/sheetrock.min.js");</script>';
710

811
marked.setOptions({
912
highlight: function (code) {
@@ -76,8 +79,6 @@ function init_hints(){
7679

7780
function hint(name){
7881
var find=d2i[name]
79-
var banner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
80-
var banner2='<script src="js/head.min.js"></script><script>head.load("js/sheetrock.min.js");</script>';
8182
var add_banner='';
8283
if (find){
8384
var ob=headings.reduce((ob,v)=>{
@@ -88,9 +89,9 @@ function hint(name){
8889
var cut=tokens.slice(ob.min,ob.max);
8990
cut=extendTokens(cut);
9091
if(cut.filter(i=>/sheetrock\.min/.test(i.text||'')).length)
91-
add_banner=banner2;
92+
add_banner=srBanner;
9293
cut.links={};
93-
return banner+add_banner+marked.parser(cut);
94+
return gtBanner+hlBanner+add_banner+marked.parser(cut);
9495
}
9596
}
9697

@@ -115,14 +116,13 @@ var template = swig.compileFile(path.join(__dirname,'..','views','gcode-info.htm
115116
var gcodes=[],tags={},list={groups:[],tags:{},list:{}};
116117

117118
function getGhint(tag){
118-
var banner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
119119
var banner2="<style> .param-desc-list p { display: inline; } </style>";
120120
if (tags[tag]){
121121
var output = template({
122122
page: {category:[]},
123123
gcode: tags[tag],
124124
});
125-
return banner+banner2+output;
125+
return gtBanner+hlBanner+banner2+output;
126126
}
127127
}
128128
function parse_requires(req){
@@ -168,12 +168,16 @@ function init_gcode(){
168168
list.list[i].sort();
169169
});
170170
}
171+
var init_gt = () =>
172+
promisify(fs.readFile)(path.join(__dirname, '..', 'views', 'gt.html'))
173+
.then(txt => gtBanner = txt)
171174

172175
exports.init=(verbose)=>
173176
init_hints()
174177
.then(a=>verbose&&console.log('loaded configuration hints'))
175178
.then(init_gcode)
176179
.then(a=>verbose&&console.log('loaded gcodes'))
180+
.then(init_gt)
177181

178182
exports.marked=marked;
179183
exports.hint=hint;

static/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@
113113
max-height: 500px;
114114
overflow-y: auto;
115115
}
116+
.mct-hint iframe {
117+
width: 100%;
118+
height: 100%;
119+
border: none;
120+
margin-bottom: -10px;
121+
}
116122
</style>
117123
<script>
118124
//open links externally by default
@@ -564,7 +570,7 @@ <h4 class="alert-heading">Information</h4>
564570
<div class="col-sm-2 my-auto" data-toggle="tooltip" data-animation="false">
565571
</div>
566572
<div class="col-sm-1 my-auto">
567-
<button type="button" class="btn btn-warning btn-sm" title="Show explanation">?</button>
573+
<button type="button" class="btn btn-warning btn-sm fa fa-info" title="Show explanation"></button>
568574
</div>
569575
</div>
570576
</template>
@@ -589,6 +595,7 @@ <h4 class="alert-heading">Information</h4>
589595
</div>
590596
</div>
591597
<div class="col-lg-5 mct-hint">
598+
<iframe></iframe>
592599
</div>
593600
</div>
594601
</div>

static/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ function addNewSection(tab,id,section,sec){
3030
}
3131

3232
function loadHint(name){
33+
return $('.mct-hint iframe').attr('src', '/hint/' + name);
3334
$.ajax('/hint/'+name)
3435
.fail(ajaxAlert)
3536
.then(function(data){
3637
$('.mct-hint').html(data);
3738
})
3839
}
3940
function loadGcode(name){
41+
return $('.mct-hint iframe').attr('src', '/gcode/' + name);
4042
$.ajax('/gcode/'+name)
4143
.fail(ajaxAlert)
4244
.then(function(data){

views/gcode/M122.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
tag: m122
3+
title: TMC Debugging
4+
brief: Get TMC Debug Info
5+
author: mbuc
6+
7+
experimental: false
8+
since: 1.1.7
9+
requires: HAVE_TMC2130|HAVE_TMC2208,TMC_DEBUG
10+
group: debug
11+
12+
codes:
13+
- M122
14+
15+
long:
16+
- When sent without a parameter, returns a table of current register settings for any Trinamic TMC2130 or TMC2208 stepper motor drivers. Sending the command with the `S` parameter and a following boolean will respectively enable or disable reporting the debugging information on a continous basis.
17+
18+
notes:
19+
- Need to have `TMC_DEBUG` enabled in `Configuration_adv.h`.
20+
21+
parameters:
22+
-
23+
tag: S
24+
type: boolean
25+
optional: true
26+
description: Flag to enable/disable continuous reporting of debugging information.
27+
28+
examples:
29+
-
30+
pre: 'Enabling debugging output:'
31+
code: M122 S1
32+
-
33+
pre: 'Example Output:'
34+
code: |
35+
SENDING:M122
36+
X Y
37+
Enabled false false
38+
Set current 850 850
39+
RMS current 826 826
40+
MAX current 1165 1165
41+
Run current 26/31 26/31
42+
Hold current 13/31 13/31
43+
CS actual 13/31 13/31
44+
PWM scale 41 41
45+
vsense 1=.18 1=.18
46+
stealthChop true true
47+
msteps 16 16
48+
tstep 1048575 1048575
49+
pwm
50+
threshold 0 0
51+
[mm/s] - -
52+
OT prewarn false false
53+
OT prewarn has
54+
been triggered false false
55+
off time 5 5
56+
blank time 24 24
57+
hysterisis
58+
-end 2 2
59+
-start 3 3
60+
Stallguard thrs 0 0
61+
DRVSTATUS X Y
62+
stallguard
63+
sg_result 0 0
64+
fsactive
65+
stst X X
66+
olb
67+
ola
68+
s2gb
69+
s2ga
70+
otpw
71+
ot
72+
'Driver registers:'
73+
X = 0x80:0D:00:00
74+
Y = 0x80:0D:00:00
75+
76+
---
77+

views/gcode/M203.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ parameters:
6161
examples:
6262
-
6363
pre: 'Set max feedrate for XY to 100mm/s:'
64-
code: M203 X100 Y1000
64+
code: M203 X100 Y100
6565

6666
---
6767

views/gcode/M502.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ codes:
1212

1313
long:
1414
- Reset all configurable settings to their factory defaults.
15-
- To also reset settings in EEPROM, follow with [`M501`](/docs/gcode/M501.html).
15+
- To also reset settings in EEPROM, follow with [`M500`](/docs/gcode/M500.html).
1616

1717
notes:
1818
- This command can be used even if `EEPROM_SETTINGS` is disabled.

views/gcode/M852.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
tag: m852
3+
title: Bed Skew Compensation
4+
brief: Misalignment in the XYZ axes.
5+
author: HekTron802
6+
7+
experimental: true
8+
group: calibration
9+
10+
codes:
11+
- M852
12+
13+
long:
14+
- Bed Skew Compensation corrects for misalignment in the XY, XZ, and ZY axes through the use of correction factors.
15+
16+
notes:
17+
- Correction factors have a range of -1 to 1.
18+
- See Bed Skew Compensation section in the configuration file for more information on calculating the correction factors.
19+
20+
parameters:
21+
-
22+
tag: I
23+
type: float
24+
optional: true
25+
description: Skew correction factor for XY axis.
26+
-
27+
tag: J
28+
type: float
29+
optional: true
30+
description: Skew correction factor for XZ axis
31+
-
32+
tag: K
33+
type: float
34+
optional: true
35+
description: Skew correction factor for YZ axis
36+
-
37+
tag: S
38+
type: float
39+
optional: true
40+
description: Alias for `I` when only XY skew correction is enabled
41+
---

views/gcode/M913.md

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,72 @@
11
---
22
tag: m913
33
title: Set Hybrid Threshold Speed
4-
brief: If you know what this is…
5-
author: thinkyhead
4+
brief: TMC driver switching to spreadCycle
5+
author: mbuc
66

77
experimental: false
8-
requires: HAVE_TMC2130,HYBRID_THRESHOLD
8+
requires: HAVE_TMC2130 or HAVE_TMC2208,HYBRID_THRESHOLD
99
group: control
1010

1111
codes:
1212
- M913
1313

14-
long:
14+
long:
15+
- When `HYBRID_THRESHOLD` is enabled, the TMC driver is switched from the quieter StealthChop to spreadCycle when the feed rate for a given stepper motor is over its `_HYBRID_THRESHOLD`.
16+
- |
17+
### Individual Threshold Values
18+
- X_HYBRID_THRESHOLD
19+
- X2_HYBRID_THRESHOLD
20+
- Y_HYBRID_THRESHOLD
21+
- Y2_HYBRID_THRESHOLD
22+
- Z_HYBRID_THRESHOLD
23+
- Z2_HYBRID_THRESHOLD
24+
- E0_HYBRID_THRESHOLD
25+
- E1_HYBRID_THRESHOLD
26+
- E2_HYBRID_THRESHOLD
27+
- E3_HYBRID_THRESHOLD
28+
- E4_HYBRID_THRESHOLD
29+
1530
1631
notes:
32+
- At least one parameter must be used.
33+
- Setting `X`, `Y`, `Z`, or `E` will set the hybrid threshold for all motors that fall under that category that have the `_IS_TRINAMIC` flag set. See examples below.
1734

1835
parameters:
36+
-
37+
tag: X
38+
type: int
39+
optional: true
40+
description: Set `X_HYBRID_THRESHOLD` and `X2_HYBRID_THRESHOLD` to the provided value.
41+
42+
-
43+
tag: Y
44+
type: int
45+
optional: true
46+
description: Set `Y_HYBRID_THRESHOLD` and `Y2_HYBRID_THRESHOLD` to the provided value.
47+
48+
-
49+
tag: Z
50+
type: int
51+
optional: true
52+
description: Set `Z_HYBRID_THRESHOLD` and `Z2_HYBRID_THRESHOLD` to the provided value.
53+
54+
-
55+
tag: E
56+
type: int
57+
optional: true
58+
description: Set `E0_HYBRID_THRESHOLD` and `E1_HYBRID_THRESHOLD` and `E2_HYBRID_THRESHOLD` and `E3_HYBRID_THRESHOLD` to the provided value.
1959

2060
examples:
61+
-
62+
pre: 'In this case, assume that `X_IS_TRINAMIC` and `X2_IS_TRINAMIC` are both enabled in `Configuration_adv.h`. '
63+
post: 'Both `X_HYBRID_THRESHOLD` and `X2_HYBRID_THRESHOLD` are set to 100.'
64+
code: M913 X100
65+
66+
-
67+
pre: 'In this case, assume that `X_IS_TRINAMIC`, `X2_IS_TRINAMIC`, `Y_IS_TRINAMIC`, `E0_IS_TRINAMIC`, and `E2_IS_TRINAMIC` are enabled in `Configuration_adv.h`.'
68+
post: '`X_HYBRID_THRESHOLD` and `X2_HYBRID_THRESHOLD` are set to 100. `Y_HYBRID_THRESHOLD` is set to 120. `E0__HYBRID_THRESHOLD` and `E2_HYBRID_THRESHOLD` are both set to 30. `E1_HYBRID_THRESHOLD` is not changed since the `E0_IS_TRINAMIC` flag is not set.'
69+
code: M913 X100 Y120 E30
2170

2271
---
2372

views/gcode/M914.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
tag: m914
33
title: TMC Bump Sensitivity
44
brief: Set sensorless homing sensitivity
5-
author: thinkyhead
5+
author: thinkyhead,mbuc
66

77
experimental: false
88
requires: HAVE_TMC2130,SENSORLESS_HOMING
@@ -14,6 +14,10 @@ codes:
1414
long: Some TMC stepper drivers have the ability to detect when they bump into something that causes them to stop moving. This feature is so sensitive that it can actually take the place of traditional endstops. Set the bump sensitivity for the X and Y stepper drivers here.
1515

1616
notes:
17+
- Requires `SENSORLESS_HOMING` in `Configuration_adv.h`.
18+
- This feature is currently only compatible with the TMC2130.
19+
- It is advised to set both `X_HOME_BUMP_MM` and `Y_HOME_BUMP_MM` to 0.
20+
- Higher values = Lower sensitivity.
1721

1822
parameters:
1923
-

views/gt.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<base href="..">
2+
<!-- Bootstrap -->
3+
<link href="libs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
4+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
5+
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
6+
<script src="libs/jquery/dist/jquery.min.js"></script>
7+
<!-- Include all compiled plugins (below), or include individual files as needed -->
8+
<script src="libs/tether/dist/js/tether.min.js"></script>
9+
<script src="libs/bootstrap/dist/js/bootstrap.min.js"></script>
10+
11+
<div id="google_translate_element"></div><script type="text/javascript">
12+
function googleTranslateElementInit() {
13+
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.TOP_RIGHT}, 'google_translate_element');
14+
}
15+
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

0 commit comments

Comments
 (0)