Add LCD menu for DAC
This commit is contained in:
committed by
Scott Lahteine
parent
00261cbfcb
commit
13c9dcc600
@ -49,6 +49,7 @@
|
||||
|
||||
bool dac_present = false;
|
||||
const uint8_t dac_order[NUM_AXIS] = DAC_STEPPER_ORDER;
|
||||
uint16_t dac_channel_pct[XYZE];
|
||||
|
||||
int dac_init() {
|
||||
#if PIN_EXISTS(DAC_DISABLE)
|
||||
@ -86,7 +87,13 @@
|
||||
}
|
||||
|
||||
static float dac_perc(int8_t n) { return 100.0 * mcp4728_getValue(dac_order[n]) / DAC_STEPPER_MAX; }
|
||||
static float dac_amps(int8_t n) { return ((2.048 * mcp4728_getValue(dac_order[n])) / 4096.0) / (8.0 * DAC_STEPPER_SENSE); }
|
||||
static float dac_amps(int8_t n) { return (mcp4728_getDrvPct(dac_order[n])*DAC_STEPPER_MAX) / (8.0 * DAC_STEPPER_SENSE); }
|
||||
|
||||
int16_t dac_current_get_percent(int8_t axis) {return mcp4728_getDrvPct(dac_order[axis]); }
|
||||
void dac_current_set_percents(int16_t pct[XYZE]) {
|
||||
LOOP_XYZE(i) dac_channel_pct[i] = pct[dac_order[i]];
|
||||
mcp4728_setDrvPct(dac_channel_pct);
|
||||
}
|
||||
|
||||
void dac_print_values() {
|
||||
if (!dac_present) return;
|
||||
@ -94,16 +101,15 @@
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Stepper current values in % (Amps):");
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" X:", dac_perc(0));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(0));
|
||||
SERIAL_ECHOPAIR(") Y:", dac_perc(1));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(1));
|
||||
SERIAL_ECHOPAIR(") Z:", dac_perc(2));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(2));
|
||||
SERIAL_ECHOPAIR(") E:", dac_perc(3));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(3));
|
||||
SERIAL_CHAR(')');
|
||||
SERIAL_EOL;
|
||||
SERIAL_ECHOPAIR(" X:", dac_perc(X_AXIS));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(X_AXIS));
|
||||
SERIAL_ECHOPAIR(") Y:", dac_perc(Y_AXIS));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(Y_AXIS));
|
||||
SERIAL_ECHOPAIR(") Z:", dac_perc(Z_AXIS));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(Z_AXIS));
|
||||
SERIAL_ECHOPAIR(") E:", dac_perc(E_AXIS));
|
||||
SERIAL_ECHOPAIR(" (", dac_amps(E_AXIS));
|
||||
SERIAL_ECHOLN(")");
|
||||
}
|
||||
|
||||
void dac_commit_eeprom() {
|
||||
|
Reference in New Issue
Block a user