Skip to content

Commit

Permalink
add GT for hints & gcodes documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
akaJes committed Jan 11, 2018
1 parent 062d78d commit dbd219e
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 14 deletions.
16 changes: 10 additions & 6 deletions app/hints.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ var marked = require('marked');
var hljs=require('highlight.js');
var path= require('path');
var http = require('https');
var gtBanner = '';
var hlBanner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
var srBanner='<script src="js/head.min.js"></script><script>head.load("js/sheetrock.min.js");</script>';

marked.setOptions({
highlight: function (code) {
Expand Down Expand Up @@ -76,8 +79,6 @@ function init_hints(){

function hint(name){
var find=d2i[name]
var banner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
var banner2='<script src="js/head.min.js"></script><script>head.load("js/sheetrock.min.js");</script>';
var add_banner='';
if (find){
var ob=headings.reduce((ob,v)=>{
Expand All @@ -88,9 +89,9 @@ function hint(name){
var cut=tokens.slice(ob.min,ob.max);
cut=extendTokens(cut);
if(cut.filter(i=>/sheetrock\.min/.test(i.text||'')).length)
add_banner=banner2;
add_banner=srBanner;
cut.links={};
return banner+add_banner+marked.parser(cut);
return gtBanner+hlBanner+add_banner+marked.parser(cut);
}
}

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

function getGhint(tag){
var banner='<link rel="stylesheet" title="Default" href="libs/highlight.js/styles/default.css">';
var banner2="<style> .param-desc-list p { display: inline; } </style>";
if (tags[tag]){
var output = template({
page: {category:[]},
gcode: tags[tag],
});
return banner+banner2+output;
return gtBanner+hlBanner+banner2+output;
}
}
function parse_requires(req){
Expand Down Expand Up @@ -168,12 +168,16 @@ function init_gcode(){
list.list[i].sort();
});
}
var init_gt = () =>
promisify(fs.readFile)(path.join(__dirname, '..', 'views', 'gt.html'))
.then(txt => gtBanner = txt)

exports.init=(verbose)=>
init_hints()
.then(a=>verbose&&console.log('loaded configuration hints'))
.then(init_gcode)
.then(a=>verbose&&console.log('loaded gcodes'))
.then(init_gt)

exports.marked=marked;
exports.hint=hint;
Expand Down
9 changes: 8 additions & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
max-height: 500px;
overflow-y: auto;
}
.mct-hint iframe {
width: 100%;
height: 100%;
border: none;
margin-bottom: -10px;
}
</style>
<script>
//open links externally by default
Expand Down Expand Up @@ -564,7 +570,7 @@ <h4 class="alert-heading">Information</h4>
<div class="col-sm-2 my-auto" data-toggle="tooltip" data-animation="false">
</div>
<div class="col-sm-1 my-auto">
<button type="button" class="btn btn-warning btn-sm" title="Show explanation">?</button>
<button type="button" class="btn btn-warning btn-sm fa fa-info" title="Show explanation"></button>
</div>
</div>
</template>
Expand All @@ -589,6 +595,7 @@ <h4 class="alert-heading">Information</h4>
</div>
</div>
<div class="col-lg-5 mct-hint">
<iframe></iframe>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ function addNewSection(tab,id,section,sec){
}

function loadHint(name){
return $('.mct-hint iframe').attr('src', '/hint/' + name);
$.ajax('/hint/'+name)
.fail(ajaxAlert)
.then(function(data){
$('.mct-hint').html(data);
})
}
function loadGcode(name){
return $('.mct-hint iframe').attr('src', '/gcode/' + name);
$.ajax('/gcode/'+name)
.fail(ajaxAlert)
.then(function(data){
Expand Down
77 changes: 77 additions & 0 deletions views/gcode/M122.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
tag: m122
title: TMC Debugging
brief: Get TMC Debug Info
author: mbuc

experimental: false
since: 1.1.7
requires: HAVE_TMC2130|HAVE_TMC2208,TMC_DEBUG
group: debug

codes:
- M122

long:
- 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.

notes:
- Need to have `TMC_DEBUG` enabled in `Configuration_adv.h`.

parameters:
-
tag: S
type: boolean
optional: true
description: Flag to enable/disable continuous reporting of debugging information.

examples:
-
pre: 'Enabling debugging output:'
code: M122 S1
-
pre: 'Example Output:'
code: |
SENDING:M122
X Y
Enabled false false
Set current 850 850
RMS current 826 826
MAX current 1165 1165
Run current 26/31 26/31
Hold current 13/31 13/31
CS actual 13/31 13/31
PWM scale 41 41
vsense 1=.18 1=.18
stealthChop true true
msteps 16 16
tstep 1048575 1048575
pwm
threshold 0 0
[mm/s] - -
OT prewarn false false
OT prewarn has
been triggered false false
off time 5 5
blank time 24 24
hysterisis
-end 2 2
-start 3 3
Stallguard thrs 0 0
DRVSTATUS X Y
stallguard
sg_result 0 0
fsactive
stst X X
olb
ola
s2gb
s2ga
otpw
ot
'Driver registers:'
X = 0x80:0D:00:00
Y = 0x80:0D:00:00
---

2 changes: 1 addition & 1 deletion views/gcode/M203.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ parameters:
examples:
-
pre: 'Set max feedrate for XY to 100mm/s:'
code: M203 X100 Y1000
code: M203 X100 Y100

---

2 changes: 1 addition & 1 deletion views/gcode/M502.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ codes:

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

notes:
- This command can be used even if `EEPROM_SETTINGS` is disabled.
Expand Down
41 changes: 41 additions & 0 deletions views/gcode/M852.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
tag: m852
title: Bed Skew Compensation
brief: Misalignment in the XYZ axes.
author: HekTron802

experimental: true
group: calibration

codes:
- M852

long:
- Bed Skew Compensation corrects for misalignment in the XY, XZ, and ZY axes through the use of correction factors.

notes:
- Correction factors have a range of -1 to 1.
- See Bed Skew Compensation section in the configuration file for more information on calculating the correction factors.

parameters:
-
tag: I
type: float
optional: true
description: Skew correction factor for XY axis.
-
tag: J
type: float
optional: true
description: Skew correction factor for XZ axis
-
tag: K
type: float
optional: true
description: Skew correction factor for YZ axis
-
tag: S
type: float
optional: true
description: Alias for `I` when only XY skew correction is enabled
---
57 changes: 53 additions & 4 deletions views/gcode/M913.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,72 @@
---
tag: m913
title: Set Hybrid Threshold Speed
brief: If you know what this is…
author: thinkyhead
brief: TMC driver switching to spreadCycle
author: mbuc

experimental: false
requires: HAVE_TMC2130,HYBRID_THRESHOLD
requires: HAVE_TMC2130 or HAVE_TMC2208,HYBRID_THRESHOLD
group: control

codes:
- M913

long:
long:
- 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`.
- |
### Individual Threshold Values
- X_HYBRID_THRESHOLD
- X2_HYBRID_THRESHOLD
- Y_HYBRID_THRESHOLD
- Y2_HYBRID_THRESHOLD
- Z_HYBRID_THRESHOLD
- Z2_HYBRID_THRESHOLD
- E0_HYBRID_THRESHOLD
- E1_HYBRID_THRESHOLD
- E2_HYBRID_THRESHOLD
- E3_HYBRID_THRESHOLD
- E4_HYBRID_THRESHOLD
notes:
- At least one parameter must be used.
- 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.

parameters:
-
tag: X
type: int
optional: true
description: Set `X_HYBRID_THRESHOLD` and `X2_HYBRID_THRESHOLD` to the provided value.

-
tag: Y
type: int
optional: true
description: Set `Y_HYBRID_THRESHOLD` and `Y2_HYBRID_THRESHOLD` to the provided value.

-
tag: Z
type: int
optional: true
description: Set `Z_HYBRID_THRESHOLD` and `Z2_HYBRID_THRESHOLD` to the provided value.

-
tag: E
type: int
optional: true
description: Set `E0_HYBRID_THRESHOLD` and `E1_HYBRID_THRESHOLD` and `E2_HYBRID_THRESHOLD` and `E3_HYBRID_THRESHOLD` to the provided value.

examples:
-
pre: 'In this case, assume that `X_IS_TRINAMIC` and `X2_IS_TRINAMIC` are both enabled in `Configuration_adv.h`. '
post: 'Both `X_HYBRID_THRESHOLD` and `X2_HYBRID_THRESHOLD` are set to 100.'
code: M913 X100

-
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`.'
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.'
code: M913 X100 Y120 E30

---

6 changes: 5 additions & 1 deletion views/gcode/M914.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tag: m914
title: TMC Bump Sensitivity
brief: Set sensorless homing sensitivity
author: thinkyhead
author: thinkyhead,mbuc

experimental: false
requires: HAVE_TMC2130,SENSORLESS_HOMING
Expand All @@ -14,6 +14,10 @@ codes:
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.

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

parameters:
-
Expand Down
15 changes: 15 additions & 0 deletions views/gt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<base href="..">
<!-- Bootstrap -->
<link href="libs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="libs/jquery/dist/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="libs/tether/dist/js/tether.min.js"></script>
<script src="libs/bootstrap/dist/js/bootstrap.min.js"></script>

<div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.FloatPosition.TOP_RIGHT}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

0 comments on commit dbd219e

Please sign in to comment.