Hyperfine, Filament Runout Sensor, some fixes...

and preparing for multiple hex files depending on needed languages
This commit is contained in:
3d-gussner 2017-10-14 12:13:18 +02:00 committed by GitHub
parent b18035a517
commit 730f6a0d10
14 changed files with 1040 additions and 783 deletions

View File

@ -85,7 +85,7 @@
//#define STRING_VERSION "1.0.2"
#define STRING_VERSION_CONFIG_H __DATE__ " " __TIME__ // build date and time
#define STRING_CONFIG_H_AUTHOR "(none, default config)" // Who made the changes.
#define STRING_CONFIG_H_AUTHOR "3d-gussner,1014v5" // Who made the changes.
// SERIAL_PORT selects which serial port should be used for communication with the host.
// This allows the connection of wireless adapters (for instance) to non-default port pins.
@ -93,7 +93,7 @@
#define SERIAL_PORT 0
// This determines the communication speed of the printer
#define BAUDRATE 250000
#define BAUDRATE 115200
// This enables the serial port associated to the Bluetooth interface
//#define BTENABLED // Enable BT interface on AT90USB devices

View File

@ -1243,6 +1243,7 @@ void setup()
#ifndef DEBUG_DISABLE_STARTMSGS
check_babystep(); //checking if Z babystep is in allowed range
for (int i = 0; i < 4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) {
lcd_wizard(0);
}
@ -1274,7 +1275,6 @@ void setup()
lcd_show_fullscreen_message_and_wait_P(MSG_DEFAULT_SETTINGS_LOADED);
}
}
for (int i = 0; i < 4; i++) EEPROM_read_B(EEPROM_BOWDEN_LENGTH + i * 2, &bowden_length[i]);
#endif //DEBUG_DISABLE_STARTMSGS
@ -1284,7 +1284,7 @@ void setup()
FIL_RUNOUT_INVERTING = eeprom_read_byte((uint8_t*)EEPROM_FIL_RUNOUT_INVERTING);
ENDSTOPPULLUP_FIL_RUNOUT = eeprom_read_byte((uint8_t*)EEPROM_ENDSTOPPULLUP_FIL_RUNOUT);
#endif
// end FILAMENT_RUNOUT_SENSOR
// end FILAMENT_RUNOUT_SENSOR
lcd_update_enable(true);
@ -1404,6 +1404,7 @@ void host_keepalive() {
// Before loop(), the setup() function is called by the main() routine.
void loop()
{
KEEPALIVE_STATE(NOT_BUSY);
if (usb_printing_counter > 0 && millis()-_usb_timer > 1000)
{
is_usb_printing = true;
@ -1503,7 +1504,8 @@ void get_command()
continue;
if(serial_char == '\n' ||
serial_char == '\r' ||
serial_count >= (MAX_CMD_SIZE - 1) )
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1) )
{
if(!serial_count) { //if empty line
comment_mode = false; //for new command
@ -1666,6 +1668,7 @@ void get_command()
if(serial_char == '\n' ||
serial_char == '\r' ||
(serial_char == '#' && comment_mode == false) ||
(serial_char == ':' && comment_mode == false) ||
serial_count >= (MAX_CMD_SIZE - 1)||n==-1)
{
if(card.eof()){
@ -2447,7 +2450,7 @@ void process_commands()
return;
} else if (code_seen("SERIAL HIGH")) {
MYSERIAL.println("SERIAL HIGH");
MYSERIAL.begin(250000);
MYSERIAL.begin(115200);
return;
} else if(code_seen("Beat")) {
// Kick farm link timer
@ -2474,7 +2477,9 @@ void process_commands()
#ifdef FILAMENT_RUNOUT_SENSOR
if(((READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING) == 0) && fil_runout_active) {
feedmultiplyBckp=feedmultiply;
//enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
enquecommand_front_P((PSTR(FILAMENT_RUNOUT_SCRIPT)));
/* feedmultiplyBckp=feedmultiply;
float target[4];
float lastpos[4];
target[X_AXIS]=current_position[X_AXIS];
@ -2493,6 +2498,9 @@ void process_commands()
target[Z_AXIS]+= FILAMENTCHANGE_ZADD ;
if(target[Z_AXIS] < 20){
target[Z_AXIS]+= 20 ;
}
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 300, active_extruder);
@ -2636,7 +2644,7 @@ void process_commands()
sprintf_P(cmd, PSTR("M220 S%i"), feedmultiplyBckp);
enquecommand(cmd);
*/
}
@ -3498,9 +3506,7 @@ void process_commands()
eeprom_bed_correction_valid ? SERIAL_PROTOCOLPGM("Bed correction data valid\n") : SERIAL_PROTOCOLPGM("Bed correction data not valid\n");
}
// bed correction routine
// PJR's amendment:
// YOKOTSUNO
// Hyperfine bed correction routine
for (uint8_t i = 0; i < 8; ++i) {
unsigned char codes[8] = { 'a', 'b', 'c', 'd' , 'e' , 'f', 'g', 'h'};
long correction = 0;
@ -5499,8 +5505,8 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
#ifdef FILAMENTCHANGE_ZADD
target[Z_AXIS]+= FILAMENTCHANGE_ZADD ;
// XXX: Removed unused var 'TooLowZ'
if(target[Z_AXIS] < 10){
target[Z_AXIS]+= 10 ;
if(target[Z_AXIS] < 20){
target[Z_AXIS]+= 20 ;
}
#endif

View File

@ -151,9 +151,9 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m
createFilename(filename, p);
SERIAL_PROTOCOL(prepend);
if (longFilename[0] != 0) {
SERIAL_PROTOCOL(longFilename);
SERIAL_PROTOCOL(longFilename);
} else {
SERIAL_PROTOCOL(filename);
SERIAL_PROTOCOL(filename);
}
MYSERIAL.write(' ');
SERIAL_PROTOCOLLN(p.fileSize);
@ -1060,7 +1060,7 @@ void CardReader::printingHasFinished()
}
autotempShutdown();
#ifdef SDCARD_SORT_ALPHA
presort();
//presort();
#endif
}
}

View File

@ -4,7 +4,7 @@
use strict;
use warnings;
my @langs = ("en","cz","it","es","pl","de","nl");
my @langs = ("en","cz","it","es","pl","de");
sub parselang
{

View File

@ -0,0 +1,351 @@
#!/usr/bin/perl
# Processes language_xx.h files into language.cpp and language.h
use strict;
use warnings;
my @langs = ("en","de","nl","fr","it");
sub parselang
{
my ($filename) = @_;
open(my $fh, '<:encoding(UTF-8)', $filename)
# open(my $fh, '<', $filename)
or die "Could not open file '$filename' $!";
# Create a new hash reference.
my $out = {};
while (my $line = <$fh>) {
chomp $line;
next if (index($line, 'define') == -1 || index($line, 'MSG') == -1);
# Skip commented lines
next if (index($line, '//') == 0);
my $modifiers = {};
my $symbol = '';
my $value = '';
if (index($line, 'define(') == -1) {
# Extended definition, which specifies the string formatting.
$line =~ /(?is)define\s*(\S*)\s*(.*)/;
$symbol = "$1";
$value = $2;
} else {
$line =~ /(?is)define\((.*)\)\s*(\S*)\s*(.*)/;
my $options = $1;
foreach my $key_value (split /,/, $options) {
if ($key_value =~ /\s*(\S*)\s*=\s*(\S*)\s*/) {
${$modifiers}{$1} = $2;
}
}
$symbol = "$2";
$value = $3;
}
next if (! defined $symbol or length($symbol) == 0);
# Trim whitespaces from both sides
$value =~ s/^\s+|\s+$//g;
#$string =~ s/" MACHINE_NAME "/Prusa i3/;
$value =~ s/" FIRMWARE_URL "/https:\/\/github.com\/prusa3d\/Prusa-i3-Plus\//;
$value =~ s/" PROTOCOL_VERSION "/1.0/;
$value =~ s/" STRINGIFY\(EXTRUDERS\) "/1/;
$value =~ s/" MACHINE_UUID "/00000000-0000-0000-0000-000000000000/;
${$out}{$symbol} = { value=>$value, %$modifiers };
}
return $out;
}
sub pgm_is_whitespace
{
my ($c) = @_;
if (! defined($c)) {
print "pgm_is_whitespace: undefined\n";
exit(1);
}
return $c == ord(' ') || $c == ord('\t') || $c == ord('\r') || $c == ord('\n');
}
sub pgm_is_interpunction
{
my ($c) = @_;
return $c == ord('.') || $c == ord(',') || $c == ord(':') || $c == ord(';') || $c == ord('?') || $c == ord('!') || $c == ord('/');
}
sub break_text_fullscreen
{
my $lines = [];
my ($text_str, $max_linelen) = @_;
if (! defined($text_str) || length($text_str) < 2) {
return $lines;
}
$text_str =~ s/^"//;
$text_str =~ s/([^\\])"/$1/;
$text_str =~ s/\\"/"/;
my @msg = unpack("W*", $text_str);
#my @msg = split("", $text_str);
my $len = $#msg + 1;
my $i = 0;
LINE:
while ($i < $len) {
while ($i < $len && pgm_is_whitespace($msg[$i])) {
$i += 1;
}
if ($i == $len) {
# End of the message.
last LINE;
}
my $msgend2 = $i + (($max_linelen > $len) ? $len : $max_linelen);
my $msgend = $msgend2;
if ($msgend < $len && ! pgm_is_whitespace($msg[$msgend]) && ! pgm_is_interpunction($msg[$msgend])) {
# Splitting a word. Find the start of the current word.
while ($msgend > $i && ! pgm_is_whitespace($msg[$msgend - 1])) {
$msgend -= 1;
}
if ($msgend == $i) {
# Found a single long word, which cannot be split. Just cut it.
$msgend = $msgend2;
}
}
my $outstr = substr($text_str, $i, $msgend - $i);
$i = $msgend;
$outstr =~ s/~/ /g;
#print "Output string: $outstr \n";
push @$lines, $outstr;
}
return $lines;
}
my %texts;
my %attributes;
my $num_languages = 0;
if (1)
{
# First load the common strings.
my $symbols = parselang("language_common.h");
foreach my $key (keys %{$symbols}) {
if (! (exists $texts{$key})) {
my $symbol_value = ${$symbols}{$key};
# Store the symbol value for each language.
$texts{$key} = [ (${$symbol_value}{value}) x ($#langs+1) ];
# Store the possible attributes.
delete ${$symbol_value}{value};
# Store an "is common" attribute.
${$symbol_value}{common} = 1;
# 4x 80 characters, 4 lines sent over serial line.
${$symbol_value}{length} = 320;
${$symbol_value}{lines} = 1;
$attributes{$key} = $symbol_value;
} else {
print "Duplicate key in language_common.h: $key\n";
}
}
}
foreach my $lang (@langs) {
my $symbols = parselang("language_$lang.h");
foreach my $key (keys %{$symbols}) {
if (! (exists $texts{$key})) {
$texts{$key} = [];
}
my $symbol_value = ${$symbols}{$key};
my $strings = $texts{$key};
if (defined $attributes{$key} && defined ${$attributes{$key}}{common} && ${$attributes{$key}}{common} == 1) {
# Common overrides the possible definintions in the language specific files.
} else {
die "Symbol $key defined first in $lang, undefined in the preceding language files."
if (scalar(@$strings) != $num_languages);
push @$strings, ${$symbol_value}{value};
if ($lang eq 'en') {
# The english texts may contain attributes. Store them into %attributes.
delete ${$symbol_value}{value};
$attributes{$key} = $symbol_value;
}
}
}
$num_languages += 1;
foreach my $key (keys %texts) {
my $strings = $texts{$key};
if (scalar(@$strings) < $num_languages) {
# die "Symbol $key undefined in $lang."
print "Symbol $key undefined in language \"$lang\". Using the english variant:\n";
print "\t", ${$strings}[0], "\n";
push @$strings, ${$strings}[0];
}
}
}
my $filename = 'language_all.h';
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
# For the programmatic access to the program memory, read
# http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html
print $fh <<END
#ifndef LANGUAGE_ALL_H
#define LANGUAGE_ALL_H
#include <avr/pgmspace.h>
// Language indices into their particular symbol tables.
END
;
# Export symbolic IDs of languages.
for my $i (0 .. $#langs) {
my $lang = uc $langs[$i];
print $fh "#define LANG_ID_$lang $i\n";
}
print $fh <<END
// Language is not defined and it shall be selected from the menu.
#define LANG_ID_FORCE_SELECTION 254
// Language is not defined on a virgin RAMBo board.
#define LANG_ID_UNDEFINED 255
// Default language ID, if no language is selected.
#define LANG_ID_DEFAULT LANG_ID_EN
// Number of languages available in the language table.
#define LANG_NUM ${num_languages}
// Currectly active language selection.
extern unsigned char lang_selected;
#define LANG_TABLE_SELECT_EXPLICIT(TABLE, LANG) ((const char*)(pgm_read_ptr(TABLE + (LANG))))
#define LANG_TABLE_SELECT(TABLE) LANG_TABLE_SELECT_EXPLICIT(TABLE, lang_selected)
END
;
foreach my $key (sort(keys %texts)) {
my $strings = $texts{$key};
if (@{$strings} == grep { $_ eq ${$strings}[0] } @{$strings}) {
# All strings are English.
print $fh "extern const char* const ${key}_LANG_TABLE[1];\n";
print $fh "#define $key LANG_TABLE_SELECT_EXPLICIT(${key}_LANG_TABLE, 0)\n";
} else {
print $fh "extern const char* const ${key}_LANG_TABLE[LANG_NUM];\n";
print $fh "#define $key LANG_TABLE_SELECT(${key}_LANG_TABLE)\n";
print $fh "#define ${key}_EXPLICIT(LANG) LANG_TABLE_SELECT_EXPLICIT(${key}_LANG_TABLE, LANG)\n"
if ($key eq "MSG_LANGUAGE_NAME" || $key eq "MSG_LANGUAGE_SELECT");
}
}
print $fh <<END
extern char* CAT2(const char *s1,const char *s2);
extern char* CAT4(const char *s1,const char *s2,const char *s3,const char *s4);
#endif //LANGUAGE_ALL.H
END
;
close $fh;
print ".h created\n";
$filename = 'language_all.cpp';
open($fh, '>', $filename) or die "Could not open file '$filename' $!";
print $fh <<'END'
#include "Configuration_prusa.h"
#include "language_all.h"
#define LCD_WIDTH 20
extern unsigned char lang_selected;
END
;
my @keys = sort(keys %texts);
foreach my $key (@keys) {
my $strings = $texts{$key};
if (@{$strings} == grep { $_ eq ${$strings}[0] } @{$strings}) {
# Shrink the array to a single value.
$strings = [${$strings}[0]];
}
for (my $i = 0; $i <= $#{$strings}; $i ++) {
my $suffix = uc($langs[$i]);
if ($i == 0 || ${$strings}[$i] ne ${$strings}[0]) {
print $fh "const char ${key}_${suffix}[] PROGMEM = ${$strings}[$i];\n";
}
}
my $langnum = $#{$strings}+1;
if ($langnum == $#langs+1) {
$langnum = "LANG_NUM";
}
print $fh "const char * const ${key}_LANG_TABLE[$langnum] PROGMEM = {\n";
for (my $i = 0; $i <= $#{$strings}; $i ++) {
my $suffix = uc($langs[$i]);
if ($i == 0 || ${$strings}[$i] ne ${$strings}[0]) {
print $fh "\t${key}_${suffix}";
} else {
print $fh "\t${key}_EN";
}
print $fh ',' if $i < $#{$strings};
print $fh "\n";
}
print $fh "};\n\n";
}
print $fh <<'END'
char langbuffer[LCD_WIDTH+1];
char* CAT2(const char *s1,const char *s2) {
unsigned char len=0;
strncpy_P(langbuffer+len,s1,LCD_WIDTH-len);
len+=strlen_P(s1);
strncpy_P(langbuffer+len,s2,LCD_WIDTH-len);
return langbuffer;
}
char* CAT4(const char *s1,const char *s2,const char *s3,const char *s4) {
unsigned char len=0;
strncpy_P(langbuffer+len,s1,LCD_WIDTH-len);
len+=strlen_P(s1);
strncpy_P(langbuffer+len,s2,LCD_WIDTH-len);
len+=strlen_P(s2);
strncpy_P(langbuffer+len,s3,LCD_WIDTH-len);
len+=strlen_P(s3);
strncpy_P(langbuffer+len,s4,LCD_WIDTH-len);
return langbuffer;
}
END
;
print ".cpp created.\nDone!\n";
my $verify_only = 1;
for my $lang (0 .. $#langs) {
print "Language: $langs[$lang]\n";
foreach my $key (@keys) {
my $strings = $texts{$key};
my %attrib = %{$attributes{$key}};
my $message = ${$strings}[$lang];
$message =~ /\S*"(.*)"\S*/;
$message = $1;
if ($lang == 0 || ${$strings}[0] ne $message) {
# If the language is not English, don't show the non-translated message.
my $max_nlines = $attrib{lines} // 1;
my $max_linelen = $attrib{length} // (($max_nlines > 1) ? 20 : 17);
# if (! $verify_only) {
# if ($nlines > 1) {
# print "Multi-line message: $message. Breaking to $nlines lines:\n";
# print "\t$_\n" foreach (@{$lines});
# }
# }
if ($max_nlines <= 1) {
my $linelen = length($message);
if ($linelen > $max_linelen) {
print "Key $key, language $langs[$lang], line length: $linelen, max length: $max_linelen\n";
print "\t$message\n";
}
} else {
my $lines = break_text_fullscreen($message, $max_linelen);
my $nlines = @{$lines};
if ($nlines > $max_nlines) {
print "Key $key, language $langs[$lang], lines: $nlines, max lines: $max_nlines\n";
print "\t$_\n" foreach (@{$lines});
}
}
}
}
}

View File

@ -0,0 +1,351 @@
#!/usr/bin/perl
# Processes language_xx.h files into language.cpp and language.h
use strict;
use warnings;
my @langs = ("en","es","fr,"it");
sub parselang
{
my ($filename) = @_;
open(my $fh, '<:encoding(UTF-8)', $filename)
# open(my $fh, '<', $filename)
or die "Could not open file '$filename' $!";
# Create a new hash reference.
my $out = {};
while (my $line = <$fh>) {
chomp $line;
next if (index($line, 'define') == -1 || index($line, 'MSG') == -1);
# Skip commented lines
next if (index($line, '//') == 0);
my $modifiers = {};
my $symbol = '';
my $value = '';
if (index($line, 'define(') == -1) {
# Extended definition, which specifies the string formatting.
$line =~ /(?is)define\s*(\S*)\s*(.*)/;
$symbol = "$1";
$value = $2;
} else {
$line =~ /(?is)define\((.*)\)\s*(\S*)\s*(.*)/;
my $options = $1;
foreach my $key_value (split /,/, $options) {
if ($key_value =~ /\s*(\S*)\s*=\s*(\S*)\s*/) {
${$modifiers}{$1} = $2;
}
}
$symbol = "$2";
$value = $3;
}
next if (! defined $symbol or length($symbol) == 0);
# Trim whitespaces from both sides
$value =~ s/^\s+|\s+$//g;
#$string =~ s/" MACHINE_NAME "/Prusa i3/;
$value =~ s/" FIRMWARE_URL "/https:\/\/github.com\/prusa3d\/Prusa-i3-Plus\//;
$value =~ s/" PROTOCOL_VERSION "/1.0/;
$value =~ s/" STRINGIFY\(EXTRUDERS\) "/1/;
$value =~ s/" MACHINE_UUID "/00000000-0000-0000-0000-000000000000/;
${$out}{$symbol} = { value=>$value, %$modifiers };
}
return $out;
}
sub pgm_is_whitespace
{
my ($c) = @_;
if (! defined($c)) {
print "pgm_is_whitespace: undefined\n";
exit(1);
}
return $c == ord(' ') || $c == ord('\t') || $c == ord('\r') || $c == ord('\n');
}
sub pgm_is_interpunction
{
my ($c) = @_;
return $c == ord('.') || $c == ord(',') || $c == ord(':') || $c == ord(';') || $c == ord('?') || $c == ord('!') || $c == ord('/');
}
sub break_text_fullscreen
{
my $lines = [];
my ($text_str, $max_linelen) = @_;
if (! defined($text_str) || length($text_str) < 2) {
return $lines;
}
$text_str =~ s/^"//;
$text_str =~ s/([^\\])"/$1/;
$text_str =~ s/\\"/"/;
my @msg = unpack("W*", $text_str);
#my @msg = split("", $text_str);
my $len = $#msg + 1;
my $i = 0;
LINE:
while ($i < $len) {
while ($i < $len && pgm_is_whitespace($msg[$i])) {
$i += 1;
}
if ($i == $len) {
# End of the message.
last LINE;
}
my $msgend2 = $i + (($max_linelen > $len) ? $len : $max_linelen);
my $msgend = $msgend2;
if ($msgend < $len && ! pgm_is_whitespace($msg[$msgend]) && ! pgm_is_interpunction($msg[$msgend])) {
# Splitting a word. Find the start of the current word.
while ($msgend > $i && ! pgm_is_whitespace($msg[$msgend - 1])) {
$msgend -= 1;
}
if ($msgend == $i) {
# Found a single long word, which cannot be split. Just cut it.
$msgend = $msgend2;
}
}
my $outstr = substr($text_str, $i, $msgend - $i);
$i = $msgend;
$outstr =~ s/~/ /g;
#print "Output string: $outstr \n";
push @$lines, $outstr;
}
return $lines;
}
my %texts;
my %attributes;
my $num_languages = 0;
if (1)
{
# First load the common strings.
my $symbols = parselang("language_common.h");
foreach my $key (keys %{$symbols}) {
if (! (exists $texts{$key})) {
my $symbol_value = ${$symbols}{$key};
# Store the symbol value for each language.
$texts{$key} = [ (${$symbol_value}{value}) x ($#langs+1) ];
# Store the possible attributes.
delete ${$symbol_value}{value};
# Store an "is common" attribute.
${$symbol_value}{common} = 1;
# 4x 80 characters, 4 lines sent over serial line.
${$symbol_value}{length} = 320;
${$symbol_value}{lines} = 1;
$attributes{$key} = $symbol_value;
} else {
print "Duplicate key in language_common.h: $key\n";
}
}
}
foreach my $lang (@langs) {
my $symbols = parselang("language_$lang.h");
foreach my $key (keys %{$symbols}) {
if (! (exists $texts{$key})) {
$texts{$key} = [];
}
my $symbol_value = ${$symbols}{$key};
my $strings = $texts{$key};
if (defined $attributes{$key} && defined ${$attributes{$key}}{common} && ${$attributes{$key}}{common} == 1) {
# Common overrides the possible definintions in the language specific files.
} else {
die "Symbol $key defined first in $lang, undefined in the preceding language files."
if (scalar(@$strings) != $num_languages);
push @$strings, ${$symbol_value}{value};
if ($lang eq 'en') {
# The english texts may contain attributes. Store them into %attributes.
delete ${$symbol_value}{value};
$attributes{$key} = $symbol_value;
}
}
}
$num_languages += 1;
foreach my $key (keys %texts) {
my $strings = $texts{$key};
if (scalar(@$strings) < $num_languages) {
# die "Symbol $key undefined in $lang."
print "Symbol $key undefined in language \"$lang\". Using the english variant:\n";
print "\t", ${$strings}[0], "\n";
push @$strings, ${$strings}[0];
}
}
}
my $filename = 'language_all.h';
open(my $fh, '>', $filename) or die "Could not open file '$filename' $!";
# For the programmatic access to the program memory, read
# http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html
print $fh <<END
#ifndef LANGUAGE_ALL_H
#define LANGUAGE_ALL_H
#include <avr/pgmspace.h>
// Language indices into their particular symbol tables.
END
;
# Export symbolic IDs of languages.
for my $i (0 .. $#langs) {
my $lang = uc $langs[$i];
print $fh "#define LANG_ID_$lang $i\n";
}
print $fh <<END
// Language is not defined and it shall be selected from the menu.
#define LANG_ID_FORCE_SELECTION 254
// Language is not defined on a virgin RAMBo board.
#define LANG_ID_UNDEFINED 255
// Default language ID, if no language is selected.
#define LANG_ID_DEFAULT LANG_ID_EN
// Number of languages available in the language table.
#define LANG_NUM ${num_languages}
// Currectly active language selection.
extern unsigned char lang_selected;
#define LANG_TABLE_SELECT_EXPLICIT(TABLE, LANG) ((const char*)(pgm_read_ptr(TABLE + (LANG))))
#define LANG_TABLE_SELECT(TABLE) LANG_TABLE_SELECT_EXPLICIT(TABLE, lang_selected)
END
;
foreach my $key (sort(keys %texts)) {
my $strings = $texts{$key};
if (@{$strings} == grep { $_ eq ${$strings}[0] } @{$strings}) {
# All strings are English.
print $fh "extern const char* const ${key}_LANG_TABLE[1];\n";
print $fh "#define $key LANG_TABLE_SELECT_EXPLICIT(${key}_LANG_TABLE, 0)\n";
} else {
print $fh "extern const char* const ${key}_LANG_TABLE[LANG_NUM];\n";
print $fh "#define $key LANG_TABLE_SELECT(${key}_LANG_TABLE)\n";
print $fh "#define ${key}_EXPLICIT(LANG) LANG_TABLE_SELECT_EXPLICIT(${key}_LANG_TABLE, LANG)\n"
if ($key eq "MSG_LANGUAGE_NAME" || $key eq "MSG_LANGUAGE_SELECT");
}
}
print $fh <<END
extern char* CAT2(const char *s1,const char *s2);
extern char* CAT4(const char *s1,const char *s2,const char *s3,const char *s4);
#endif //LANGUAGE_ALL.H
END
;
close $fh;
print ".h created\n";
$filename = 'language_all.cpp';
open($fh, '>', $filename) or die "Could not open file '$filename' $!";
print $fh <<'END'
#include "Configuration_prusa.h"
#include "language_all.h"
#define LCD_WIDTH 20
extern unsigned char lang_selected;
END
;
my @keys = sort(keys %texts);
foreach my $key (@keys) {
my $strings = $texts{$key};
if (@{$strings} == grep { $_ eq ${$strings}[0] } @{$strings}) {
# Shrink the array to a single value.
$strings = [${$strings}[0]];
}
for (my $i = 0; $i <= $#{$strings}; $i ++) {
my $suffix = uc($langs[$i]);
if ($i == 0 || ${$strings}[$i] ne ${$strings}[0]) {
print $fh "const char ${key}_${suffix}[] PROGMEM = ${$strings}[$i];\n";
}
}
my $langnum = $#{$strings}+1;
if ($langnum == $#langs+1) {
$langnum = "LANG_NUM";
}
print $fh "const char * const ${key}_LANG_TABLE[$langnum] PROGMEM = {\n";
for (my $i = 0; $i <= $#{$strings}; $i ++) {
my $suffix = uc($langs[$i]);
if ($i == 0 || ${$strings}[$i] ne ${$strings}[0]) {
print $fh "\t${key}_${suffix}";
} else {
print $fh "\t${key}_EN";
}
print $fh ',' if $i < $#{$strings};
print $fh "\n";
}
print $fh "};\n\n";
}
print $fh <<'END'
char langbuffer[LCD_WIDTH+1];
char* CAT2(const char *s1,const char *s2) {
unsigned char len=0;
strncpy_P(langbuffer+len,s1,LCD_WIDTH-len);
len+=strlen_P(s1);
strncpy_P(langbuffer+len,s2,LCD_WIDTH-len);
return langbuffer;
}
char* CAT4(const char *s1,const char *s2,const char *s3,const char *s4) {
unsigned char len=0;
strncpy_P(langbuffer+len,s1,LCD_WIDTH-len);
len+=strlen_P(s1);
strncpy_P(langbuffer+len,s2,LCD_WIDTH-len);
len+=strlen_P(s2);
strncpy_P(langbuffer+len,s3,LCD_WIDTH-len);
len+=strlen_P(s3);
strncpy_P(langbuffer+len,s4,LCD_WIDTH-len);
return langbuffer;
}
END
;
print ".cpp created.\nDone!\n";
my $verify_only = 1;
for my $lang (0 .. $#langs) {
print "Language: $langs[$lang]\n";
foreach my $key (@keys) {
my $strings = $texts{$key};
my %attrib = %{$attributes{$key}};
my $message = ${$strings}[$lang];
$message =~ /\S*"(.*)"\S*/;
$message = $1;
if ($lang == 0 || ${$strings}[0] ne $message) {
# If the language is not English, don't show the non-translated message.
my $max_nlines = $attrib{lines} // 1;
my $max_linelen = $attrib{length} // (($max_nlines > 1) ? 20 : 17);
# if (! $verify_only) {
# if ($nlines > 1) {
# print "Multi-line message: $message. Breaking to $nlines lines:\n";
# print "\t$_\n" foreach (@{$lines});
# }
# }
if ($max_nlines <= 1) {
my $linelen = length($message);
if ($linelen > $max_linelen) {
print "Key $key, language $langs[$lang], line length: $linelen, max length: $max_linelen\n";
print "\t$message\n";
}
} else {
my $lines = break_text_fullscreen($message, $max_linelen);
my $nlines = @{$lines};
if ($nlines > $max_nlines) {
print "Key $key, language $langs[$lang], lines: $nlines, max lines: $max_nlines\n";
print "\t$_\n" foreach (@{$lines});
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
#define LANG_ID_ES 3
#define LANG_ID_PL 4
#define LANG_ID_DE 5
#define LANG_ID_NL 6
// Language is not defined and it shall be selected from the menu.
#define LANG_ID_FORCE_SELECTION 254
// Language is not defined on a virgin RAMBo board.
@ -19,7 +18,7 @@
#define LANG_ID_DEFAULT LANG_ID_EN
// Number of languages available in the language table.
#define LANG_NUM 7
#define LANG_NUM 6
// Currectly active language selection.
extern unsigned char lang_selected;
@ -473,6 +472,8 @@ extern const char* const MSG_REFRESH_LANG_TABLE[1];
#define MSG_REFRESH LANG_TABLE_SELECT_EXPLICIT(MSG_REFRESH_LANG_TABLE, 0)
extern const char* const MSG_RESEND_LANG_TABLE[1];
#define MSG_RESEND LANG_TABLE_SELECT_EXPLICIT(MSG_RESEND_LANG_TABLE, 0)
extern const char* const MSG_RESET_CALIBRATE_E_LANG_TABLE[1];
#define MSG_RESET_CALIBRATE_E LANG_TABLE_SELECT_EXPLICIT(MSG_RESET_CALIBRATE_E_LANG_TABLE, 0)
extern const char* const MSG_RESTORE_FAILSAFE_LANG_TABLE[1];
#define MSG_RESTORE_FAILSAFE LANG_TABLE_SELECT_EXPLICIT(MSG_RESTORE_FAILSAFE_LANG_TABLE, 0)
extern const char* const MSG_RESUME_PRINT_LANG_TABLE[LANG_NUM];
@ -593,8 +594,8 @@ extern const char* const MSG_SOFTWARE_RESET_LANG_TABLE[1];
#define MSG_SOFTWARE_RESET LANG_TABLE_SELECT_EXPLICIT(MSG_SOFTWARE_RESET_LANG_TABLE, 0)
extern const char* const MSG_SORTING_LANG_TABLE[LANG_NUM];
#define MSG_SORTING LANG_TABLE_SELECT(MSG_SORTING_LANG_TABLE)
extern const char* const MSG_SORT_ALPHA_LANG_TABLE[LANG_NUM];
#define MSG_SORT_ALPHA LANG_TABLE_SELECT(MSG_SORT_ALPHA_LANG_TABLE)
extern const char* const MSG_SORT_ALPHA_LANG_TABLE[1];
#define MSG_SORT_ALPHA LANG_TABLE_SELECT_EXPLICIT(MSG_SORT_ALPHA_LANG_TABLE, 0)
extern const char* const MSG_SORT_NONE_LANG_TABLE[LANG_NUM];
#define MSG_SORT_NONE LANG_TABLE_SELECT(MSG_SORT_NONE_LANG_TABLE)
extern const char* const MSG_SORT_TIME_LANG_TABLE[LANG_NUM];

View File

@ -258,7 +258,7 @@
#define(length=20,lines=8) MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filaments are now adjusted. Please clean the nozzle for calibration. Click when done."
#define(length=20, lines=4) MSG_STACK_ERROR "Error - static memory has been overwritten"
#define(length=20, lines=1) MSG_CALIBRATE_E "Calibrate E"
//#define(length=20, lines=1) MSG_RESET_CALIBRATE_E "Reset E Cal."
#define(length=20, lines=1) MSG_RESET_CALIBRATE_E "Reset E Cal."
#define(length=20, lines=8) MSG_E_CAL_KNOB "Rotate knob until mark reaches extruder body. Click when done."
//#define(length=20, lines=1) MSG_FARM_CARD_MENU "Farm mode print"
@ -357,10 +357,10 @@
#define(length=20, lines=2) MSG_PLA_FILAMENT_LOADED "Is PLA filament loaded?"
#define(length=20, lines=2) MSG_PLEASE_LOAD_PLA "Please load PLA filament first."
#define(length=20, lines=5) MSG_FILE_CNT "Some files will not be sorted. Max. No. of files in 1 folder for sorting is 100."
#define(length=20) MSG_FIL_RUNOUT_SETTINGS "Filament Runout S"
#define(length=20) MSG_FIL_RUNOUT_ACTIVE_ON "Sens Runout [ON]"
#define(length=20) MSG_FIL_RUNOUT_ACTIVE_OFF "Sens Runout [OFF]"
#define(length=20) MSG_ENDSTOPPULLUP_FIL_RUNOUT_ON "FR Pullup [ON]"
#define(length=20) MSG_ENDSTOPPULLUP_FIL_RUNOUT_OFF "FR Pullup [OFF]"
#define(length=20) MSG_FIL_RUNOUT_INVERTING_OFF "FR_Sens[S to VCC]"
#define(length=20) MSG_FIL_RUNOUT_INVERTING_ON "FR_Sens[S to GND]"
#define(length=20) MSG_FIL_RUNOUT_SETTINGS "Fil.Runout S "
#define(length=20) MSG_FIL_RUNOUT_ACTIVE_ON "Fil.Runout S [ON]"
#define(length=20) MSG_FIL_RUNOUT_ACTIVE_OFF "Fil.Runout S[OFF]"
#define(length=20) MSG_ENDSTOPPULLUP_FIL_RUNOUT_ON "Fil.RSPullup [ON]"
#define(length=20) MSG_ENDSTOPPULLUP_FIL_RUNOUT_OFF "Fil.RSPullup[OFF]"
#define(length=20) MSG_FIL_RUNOUT_INVERTING_OFF "Fil.RS [S to VCC]"
#define(length=20) MSG_FIL_RUNOUT_INVERTING_ON "Fil.RS [S to GND]"

View File

@ -149,6 +149,7 @@
#define MSG_SD_NOT_PRINTING "Pas d'impression SD"
#define MSG_SD_ERR_WRITE_TO_FILE "Erreur d'ecriture dans le fichier"
#define MSG_SD_CANT_ENTER_SUBDIR "Sous-repertoire de probleme d'acces: "
/* to be translated
#define MSG_STEPPER_TOO_HIGH "Schrittrate zu hoch"
#define MSG_ENDSTOPS_HIT "Endanstop erreicht"
#define MSG_ERR_COLD_EXTRUDE_STOP "Stop, Extruder kalt!"
@ -156,8 +157,9 @@
#define MSG_BABYSTEPPING_Y "Babystepping Y"
#define MSG_BABYSTEPPING_Z "Z wurde eingestellt"
#define MSG_SERIAL_ERROR_MENU_STRUCTURE "Menuestruktur fehlerhaft"
*/
#define MSG_LANGUAGE_NAME "Francais"
/*
#define MSG_LANGUAGE_SELECT "Waehle Sprache"
#define MSG_PRUSA3D "prusa3d.com"
#define MSG_PRUSA3D_FORUM "forum.prusa3d.com"
@ -265,7 +267,7 @@
#define MSG_STACK_ERROR "Error - EEPROM wurde ueberschrieben"
#define MSG_CALIBRATE_E "Kalibriere E"
//#define MSG_RESET_CALIBRATE_E "Reset E Cal."
#define MSG_RESET_CALIBRATE_E "Reset E Cal."
#define MSG_E_CAL_KNOB "Knopf drehen bis die Filamentmarkierung erreicht ist. Klicken wenn fertig."
//#define MSG_FARM_CARD_MENU "Farm mode print"
@ -370,3 +372,4 @@
#define MSG_PLA_FILAMENT_LOADED "Ist PLA Filament geladen?"
#define MSG_PLEASE_LOAD_PLA "Bitte lade erst PLA Filament."
#define MSG_FILE_CNT "Einige Dateien werden nicht sortiert, da das max. 100 Dateien pro Ordner ist."
*/

View File

@ -252,7 +252,7 @@
#define MSG_CONFIRM_NOZZLE_CLEAN_FIL_ADJ "Filamenten zijn nu ingesteld. Reinig het tuit voor de kalibratie. Klik als klaar."
#define MSG_STACK_ERROR "Error - static memory has been overwritten"
#define MSG_CALIBRATE_E "Kalibratie E"
//#define MSG_RESET_CALIBRATE_E "Reset E Cal."
#define MSG_RESET_CALIBRATE_E "Reset E Cal."
#define MSG_E_CAL_KNOB "Draai knop tot mark extruder bereikt is. Klik als klaar."
//#define MSG_FARM_CARD_MENU "Farm mode print"

View File

@ -192,7 +192,6 @@ static int lcd_selftest_screen(int _step, int _progress, int _progress_scale, b
static void lcd_selftest_screen_step(int _row, int _col, int _state, const char *_name, const char *_indicator);
static bool lcd_selftest_fan_dialog(int _fan);
static void lcd_selftest_error(int _error_no, const char *_error_1, const char *_error_2);
static void lcd_colorprint_change();
#ifdef SNMM
static void extr_adj_0();
@ -1283,7 +1282,7 @@ void lcd_commands()
lcd_commands_step = 5;
#endif
#ifdef DEFAULT_PID_BED_TEMP
lcd_commands_step = lcd_commands_step+1;
lcd_commands_step = lcd_commands_step+1;
#endif
}
@ -1537,6 +1536,8 @@ static void lcd_support_menu()
MENU_ITEM(back, PSTR("------------"), lcd_main_menu);
MENU_ITEM(back, MSG_DATE, lcd_main_menu);
MENU_ITEM(back, PSTR(__DATE__), lcd_main_menu);
MENU_ITEM(back, PSTR(__TIME__), lcd_main_menu);
MENU_ITEM(back, PSTR(STRING_CONFIG_H_AUTHOR), lcd_main_menu);
// Show the FlashAir IP address, if the card is available.
if (menuData.supportMenu.is_flash_air) {
@ -1546,7 +1547,7 @@ static void lcd_support_menu()
}
#ifndef MK1BP
MENU_ITEM(back, PSTR("------------"), lcd_main_menu);
if(!IS_SD_PRINTING) MENU_ITEM(function, MSG_XYZ_DETAILS, lcd_service_mode_show_result);
if(!IS_SD_PRINTING && !is_usb_printing) MENU_ITEM(function, MSG_XYZ_DETAILS, lcd_service_mode_show_result);
#endif //MK1BP
END_MENU();
}
@ -2762,15 +2763,15 @@ static void lcd_show_end_stops() {
lcd.setCursor(0, 0);
lcd_printPGM((PSTR("End stops/sens diag")));
lcd.setCursor(0, 1);
lcd_printPGM(((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("X1")) : (PSTR("X0")));
lcd_printPGM(((READ(X_MIN_PIN) ^ X_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("X:1")) : (PSTR("X:0")));
lcd.setCursor(0, 2);
lcd_printPGM(((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Y1")) : (PSTR("Y0")));
lcd_printPGM(((READ(Y_MIN_PIN) ^ Y_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Y:1")) : (PSTR("Y:0")));
lcd.setCursor(0, 3);
lcd_printPGM(((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Z1")) : (PSTR("Z0")));
lcd_printPGM(((READ(Z_MIN_PIN) ^ Z_MIN_ENDSTOP_INVERTING) == 1) ? (PSTR("Z:1")) : (PSTR("Z:0")));
// FILAMENT_RUNOUT_SENSOR
if (fil_runout_active) {
lcd.setCursor(4, 1);
lcd_printPGM(((READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING) == 1) ? (PSTR("FR_S1")) : (PSTR("FR_S0")));
lcd_printPGM(((READ(FIL_RUNOUT_PIN) ^ FIL_RUNOUT_INVERTING) == 1) ? (PSTR("FRS:1")) : (PSTR("FRS:0")));
}
// end FILAMENT_RUNOUT_SENSOR
}
@ -3183,6 +3184,19 @@ static void lcd_silent_mode_set() {
digipot_init();
lcd_goto_menu(lcd_settings_menu, 7);
}
static void lcd_silent_mode_set_tune() {
switch (SilentModeMenu) {
case 0: SilentModeMenu = 1; break;
case 1: SilentModeMenu = 2; break;
case 2: SilentModeMenu = 0; break;
default: SilentModeMenu = 0; break;
}
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
digipot_init();
lcd_goto_menu(lcd_tune_menu, 8);
}
static void lcd_set_lang(unsigned char lang) {
lang_selected = lang;
firstrun = 1;
@ -3463,6 +3477,7 @@ void lcd_wizard(int state) {
else state = 6;
break;
case 6: //waiting for preheat nozzle for PLA;
#ifndef SNMM
lcd_display_message_fullscreen_P(MSG_WIZARD_WILL_PREHEAT);
current_position[Z_AXIS] = 100; //move in z axis to make space for loading filament
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 60, active_extruder);
@ -3480,6 +3495,7 @@ void lcd_wizard(int state) {
lcd_set_custom_characters();
delay_keep_alive(1000);
}
#endif //not SNMM
state = 7;
break;
case 7: //load filament
@ -3602,6 +3618,13 @@ void lcd_fil_runout_active_set() {
lcd_goto_menu(lcd_fil_runout_settings_menu, 1);
}
void lcd_fil_runout_active_tune() {
fil_runout_active = !fil_runout_active;
eeprom_update_byte((unsigned char *)EEPROM_FIL_RUNOUT_ACTIVE, fil_runout_active);
digipot_init();
lcd_goto_menu(lcd_tune_menu, 9);
}
void lcd_fil_runout_inverting_set() {
FIL_RUNOUT_INVERTING = !FIL_RUNOUT_INVERTING;
eeprom_update_byte((unsigned char *)EEPROM_FIL_RUNOUT_INVERTING, FIL_RUNOUT_INVERTING);
@ -4929,17 +4952,6 @@ static void lcd_autostart_sd()
}
static void lcd_silent_mode_set_tune() {
switch (SilentModeMenu) {
case 0: SilentModeMenu = 1; break;
case 1: SilentModeMenu = 2; break;
case 2: SilentModeMenu = 0; break;
default: SilentModeMenu = 0; break;
}
eeprom_update_byte((unsigned char *)EEPROM_SILENT, SilentModeMenu);
digipot_init();
lcd_goto_menu(lcd_tune_menu, 9);
}
#endif
static void lcd_colorprint_change() {
@ -4962,24 +4974,33 @@ static void lcd_tune_menu()
START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); //1
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);//2
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 10);//3
MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 10);//4
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);//5
MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);//6
#ifdef FILAMENTCHANGEENABLE
MENU_ITEM(function, MSG_FILAMENTCHANGE, lcd_colorprint_change);//7
#endif
if (!farm_mode) { //dont show in menu if we are in farm mode
if (!farm_mode) { //dont show in menu if we are in farm mode //8
switch (SilentModeMenu) {
case 0: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
case 1: MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set); break;
case 2: MENU_ITEM(function, MSG_AUTO_MODE_ON, lcd_silent_mode_set); break;
default: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set); break;
case 0: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set_tune); break;
case 1: MENU_ITEM(function, MSG_SILENT_MODE_ON, lcd_silent_mode_set_tune); break;
case 2: MENU_ITEM(function, MSG_AUTO_MODE_ON, lcd_silent_mode_set_tune); break;
default: MENU_ITEM(function, MSG_SILENT_MODE_OFF, lcd_silent_mode_set_tune); break;
}
}
// FILAMENT_RUNOUT_SENSOR
#ifdef FILAMENT_RUNOUT_SUPPORT //9
if (fil_runout_active == false) {
MENU_ITEM(function, MSG_FIL_RUNOUT_ACTIVE_OFF, lcd_fil_runout_active_tune);
} else {
MENU_ITEM(function, MSG_FIL_RUNOUT_ACTIVE_ON, lcd_fil_runout_active_tune);
}
#endif
// end FILAMENT_RUNOUT_SENSOR
END_MENU();
}
@ -5957,6 +5978,7 @@ static bool check_file(const char* filename) {
get_command();
result = check_commands();
}
cmdqueue_reset();
card.printingHasFinished();
strncpy_P(lcd_status_message, WELCOME_MSG, LCD_WIDTH);
return result;
@ -6802,4 +6824,4 @@ void copy_and_scalePID_d()
}
*/
#endif //ULTRA_LCD
#endif //ULTRA_LCD

View File

@ -213,7 +213,7 @@ void stack_error();
void lcd_printer_connected();
void lcd_ping();
void lcd_calibrate_extruder();
//void lcd_calibrate_extruder();
void lcd_farm_sdcard_menu();
//void getFileDescription(char *name, char *description);

View File

@ -959,7 +959,7 @@ static void lcd_implementation_status_screen()
custom_message = false;
custom_message_type = 0;
}
if (custom_message_state > 3 && custom_message_state < 10 )
if (custom_message_state > 3 && custom_message_state <= 10 )
{
lcd.setCursor(0, 3);
lcd_printPGM(PSTR(" "));
@ -967,11 +967,6 @@ static void lcd_implementation_status_screen()
lcd_printPGM(MSG_HOMEYZ_DONE);
custom_message_state--;
}
if (custom_message_state == 10)
{
lcd_printPGM(MSG_HOMEYZ_DONE);
custom_message_state = 9;
}
}
}
@ -1205,12 +1200,6 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
lcd.setCursor(0, row);
lcd.print('>');
if (longFilename[0] != '\0')
{
filename = longFilename;
//longFilename[LCD_WIDTH-1] = '\0';
}
int i = 1;
int j = 0;