void temp_print() { #ifdef EXP_Board sersendf("T:%g B:%g R:%g\n", current_temp[EXTRUDER_0], current_temp[HEATED_BED_0], current_temp_r2c2); #else sersendf("T:%g B:%g ", current_temp[EXTRUDER_0], current_temp[HEATED_BED_0]); #endif }
void print_config (void) { unsigned j; for (j=0; (j < NUM_TOKENS); j++) { switch (config_lookup[j].type) { case TYPE_INT: { int32_t *pVal = config_lookup[j].pValue; sersendf ("%s = %d\r\n", config_lookup[j].name, *pVal); break; } case TYPE_DOUBLE: { double *pVal = config_lookup[j].pValue; sersendf ("%s = %g\r\n", config_lookup[j].name, *pVal); break; } } } }
void print_pwm(void){ sersendf("pwm:%g p:%g i:%g d:%g ", output, pterm,iterm,dterm); }
void temp_print() { sersendf("ok T:%u.0 B:%u.0\r\n", current_temp[EXTRUDER_0], current_temp[HEATED_BED_0]); /* for RepRap software */ }
void read_config (void) { char line[80]; char *pToken; char *pLine; unsigned j; // first set defaults for (j=0; j < NUM_TOKENS; j++) { switch (config_lookup[j].type) { case TYPE_INT: { int32_t *pVal = config_lookup[j].pValue; *pVal = config_lookup[j].val_i; break; } case TYPE_DOUBLE: { double *pVal = config_lookup[j].pValue; *pVal = config_lookup[j].val_d; break; } } } /* initialize SPI for SDCard */ spi_init(); /* access to "config.txt" file on SDCard */ FATFS fs; /* Work area (file system object) for logical drive */ FIL file; /* file object */ FRESULT res; /* FatFs function common result code */ /* Register a work area for logical drive 0 */ res = f_mount(0, &fs); if(res) debug("Err mount fs\n"); /* Open config.txt file */ res = f_open(&file, "config.txt", FA_OPEN_EXISTING | FA_READ); if (res) debug("File config.txt not found\n"); else { bool found; pLine = f_gets(line, sizeof(line), &file); /* read one line */ while (pLine) { pToken = get_token (pLine); if (pToken && *pToken != '#') { found = false; for (j=0; (j < NUM_TOKENS) && !found; j++) { if (stricmp (pToken, config_lookup[j].name) == 0) { found = true; pToken = get_token (NULL); if (pToken && (*pToken == '=')) { // get value pToken = get_token (NULL); if (pToken) { switch (config_lookup[j].type) { case TYPE_INT: { int32_t *pVal = config_lookup[j].pValue; *pVal = atoi (pToken); break; } case TYPE_DOUBLE: { double *pVal = config_lookup[j].pValue; *pVal = atod(pToken); break; } } // debug //sersendf ("Found: %s = %d\r\n", config_lookup[j].name, *config_lookup[j].pValue); } else sersendf ("Missing value for %s\r\n", config_lookup[j].name); } else sersendf ("Expected '='%s\r\n", line); } } if (!found) sersendf ("Unknown config: %s\r\n", pToken); } pLine = f_gets(line, sizeof(line), &file); /* read next line */ } /* Close config.txt file */ res = f_close(&file); if (res) debug("Error closing config.txt\n"); } // //read_gcode_file ("autoexec.g"); res = f_open(&file, "autoexec.g", FA_OPEN_EXISTING | FA_READ); if (res == FR_OK) { tLineBuffer line_buf; pLine = f_gets(line_buf.data, sizeof(line_buf.data), &file); /* read one line */ while (pLine) { line_buf.len = strlen(pLine); gcode_parse_line (&line_buf); pLine = f_gets(line_buf.data, sizeof(line_buf.data), &file); /* read next line */ } /* Close file */ res = f_close(&file); if (res) debug("Error closing autoexec.g\n"); } // /* Initialize using values read from "config.txt" file */ gcode_parse_init(); }