Skip to content

Commit

Permalink
Merge branch 'feature/2.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-galvez committed Feb 11, 2016
2 parents 842058a + 4e02be3 commit 01f72a2
Show file tree
Hide file tree
Showing 39 changed files with 933 additions and 61 deletions.
25 changes: 25 additions & 0 deletions Documentation/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# BQ Marlin v2.1.0
---
### Bugfixes:
* Fixed: Printing from SD stops if USB cable is disconnected (W2/H2).
* Fixed: Changing filament, inherited feedrate can produce sliding on extruder (W/H/HXL/W2/H2).
* Fixed serial printing from Cura 15.04 and possibly other host systems (W/H/HXL/W2/H2).
* Skip temperature animation on manual levelling when temperature is already above preheat value (W2/H2).
* Fixed: Printing position can be lost after a fast filament change (W2/H2).
* Auto-levelling option can now be build on 1st generation printers (W/H/HXL).
* Blower is now activated when a percent of speed (M106) is selected (always 100% of speed is used though) (W2/H2).
* Fixed serial printing entering in inactivity state if M800 is not used.

### Improvements:
* Reduce printing slowdown with very short segments due to screen updates (W2/H2).
* Added board serial number to M115 response over serial (W2/H2).
* Reduce one check on double homing (base detection) algorithm (W2).

### New features:
* Added an error screen when special (non supported) characters are used on file names or folders (W2/H2).
* Added a new statistics screen. Now printing time and successful/cancelled printings are stored on EEPROM (W2/H2).

### Translations:
* Italian, Russian and Portuguese fixes (W2/H2).
* Minor changes on all languages (W2/H2).

# BQ Marlin v2.0.0
---
### Under the hood:
Expand Down
2 changes: 2 additions & 0 deletions Marlin/ConfigurationStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include "ConfigurationStore.h"

#include "StorageManager.h"
#include "StatsManager.h"

void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
uint8_t c;
Expand Down Expand Up @@ -414,6 +415,7 @@ void Config_ResetDefault() {

#ifdef DOGLCD
lcd_contrast = DEFAULT_LCD_CONTRAST;
StatsManager::single::instance().loadStats();
#endif

#ifdef PIDTEMP
Expand Down
34 changes: 23 additions & 11 deletions Marlin/GuiAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
#include "LightManager.h"
#include "cardreader.h"

#ifdef DOGLCD
#include "StatsManager.h"
#endif

bool raised = false;
extern bool home_all_axis;
extern bool bed_leveling;
Expand Down Expand Up @@ -620,17 +624,7 @@ void action_start_print()
if(PrintManager::single::instance().state() == PRINTING)
{
serial_printing = false;

strcpy(cmd, card.longFilename);
for (c = &cmd[0]; *c; c++)
{
if ((uint8_t)*c > 127)
{
SERIAL_ECHOLN(MSG_SD_BAD_FILENAME);
return;
}
}


sprintf_P(cmd, PSTR("M23 %s"), card.filename);
}

Expand Down Expand Up @@ -660,6 +654,7 @@ void action_start_print()

#ifdef DOGLCD
PrintManager::single::instance().state(READY);
StatsManager::single::instance().increaseTotalPrints();
#endif //DOGLCD

enquecommand_P(PSTR("G90"));
Expand Down Expand Up @@ -763,12 +758,20 @@ void action_stop_print()
PrintManager::knownPosition(true);

stop_buffer = false;

#ifdef DOGLCD
Time_t printTime = PrintManager::single::instance().printingTime();
StatsManager::single::instance().updateTotalTime(printTime);
#endif
}

void action_finish_print()
{
action_stop_print();
action_cooldown();
#ifdef DOGLCD
StatsManager::single::instance().increaseSuccededPrints();
#endif
}

extern float target[4];
Expand Down Expand Up @@ -998,3 +1001,12 @@ bool action_check_auto_gcode()
}
return false;
}

bool action_check_pause_state()
{
if(PrintManager::single::instance().state() == PrinterState_t::PAUSED)
{
return true;
}
return false;
}
4 changes: 3 additions & 1 deletion Marlin/GuiAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@ extern void action_reset_wizard();

extern bool action_check_auto_gcode();

#endif // GUI_ACTION_H
extern bool action_check_pause_state();

#endif // GUI_ACTION_H
8 changes: 8 additions & 0 deletions Marlin/Language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,11 @@ TR(TEMP_OFF)
TR(TOTAL_TIME)
TR(SCREEN_PRINT_STOP_TITLE)
TR(SCREEN_PRINT_STOP_TEXT)
TR(SCREEN_CHANGE_WAIT_PAUSE_TITLE)
TR(SCREEN_CHANGE_WAIT_PAUSE_TEXT)
TR(OPTION_STATS)
TR(SCREEN_VIEW_STATS_TITLE)
TR(SCREEN_VIEW_STATS_TEXT1)
TR(SCREEN_VIEW_STATS_TEXT2)
TR(SCREEN_VIEW_STATS_TEXT3)
TR(SCREEN_NAME_ERROR_TEXT)
16 changes: 16 additions & 0 deletions Marlin/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,14 @@ enum class Label
TOTAL_TIME,
SCREEN_PRINT_STOP_TITLE,
SCREEN_PRINT_STOP_TEXT,
SCREEN_CHANGE_WAIT_PAUSE_TITLE,
SCREEN_CHANGE_WAIT_PAUSE_TEXT,
OPTION_STATS,
SCREEN_VIEW_STATS_TITLE,
SCREEN_VIEW_STATS_TEXT1,
SCREEN_VIEW_STATS_TEXT2,
SCREEN_VIEW_STATS_TEXT3,
SCREEN_NAME_ERROR_TEXT,
};

extern const char * MSG_SCREEN_EMERGENCY_TITLE();
Expand Down Expand Up @@ -475,5 +483,13 @@ extern const char * MSG_TEMP_OFF();
extern const char * MSG_TOTAL_TIME();
extern const char * MSG_SCREEN_PRINT_STOP_TITLE();
extern const char * MSG_SCREEN_PRINT_STOP_TEXT();
extern const char * MSG_SCREEN_CHANGE_WAIT_PAUSE_TITLE();
extern const char * MSG_SCREEN_CHANGE_WAIT_PAUSE_TEXT();
extern const char * MSG_OPTION_STATS();
extern const char * MSG_SCREEN_VIEW_STATS_TITLE();
extern const char * MSG_SCREEN_VIEW_STATS_TEXT1();
extern const char * MSG_SCREEN_VIEW_STATS_TEXT2();
extern const char * MSG_SCREEN_VIEW_STATS_TEXT3();
extern const char * MSG_SCREEN_NAME_ERROR_TEXT();

#endif // ifndef LANGUAGE_H
2 changes: 1 addition & 1 deletion Marlin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ ifeq ($(HARDWARE_DISPLAY), Graphic)
CXXSRC += GuiManager.cpp \
StepperClass.cpp Language.cpp
CXXSRC += LightManager.cpp PrintManager.cpp SDManager.cpp SerialManager.cpp SteppersManager.cpp FanManager.cpp \
TemperatureControl.cpp
TemperatureControl.cpp StatsManager.cpp
include ui/ui.mk
VPATHTEMP += ui
endif
Expand Down
27 changes: 23 additions & 4 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,16 @@ void get_command()
}
gcode_LastN = gcode_N;
//if no errors, continue parsing

char *startchar = strchr(cmdbuffer[bufindw], ' ') + 1;
strcpy(cmdbuffer[bufindw], startchar);

// Format proof parsing to remove line number
char *startchar = &(cmdbuffer[bufindw][1]);
while( (*startchar >= '0' && *startchar <= '9')
|| (*startchar == ' '))
{
startchar++;
}

strcpy(cmdbuffer[bufindw], startchar);

}
else // if we don't receive 'N' but still see '*'
Expand Down Expand Up @@ -930,6 +937,11 @@ void get_command()
buflen += 1;

serial_count = 0; //clear buffer

#ifdef DOGLCD
//Reset inactivity timer on serial command read
PrintManager::single::instance().resetInactivity();
#endif // DOGLCD
}
else if(serial_char == '\\') { //Handle escapes
SERIAL_ECHO("Escape char: ");
Expand Down Expand Up @@ -2466,7 +2478,14 @@ SERIAL_PROTOCOLPGM("\n\n");
case 106: //M106 Fan On
temp::TemperatureManager::single::instance().setBlowerControlState(false);
if (code_seen('S')){
fanSpeed=constrain(code_value(),0,255);
if(code_value() > 0)
{
fanSpeed=255;
}
else
{
fanSpeed=0;
}
}
else {
fanSpeed=255;
Expand Down
23 changes: 18 additions & 5 deletions Marlin/SDCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,25 +238,38 @@ bool SDCache::updateCachePosition(int16_t index)
}

CacheEntryType_t SDCache::press(uint16_t index)
{
{
//first a check for possible update
updateCachePosition(index);

char* c;
char cmd[LONG_FILENAME_LENGTH];
strcpy(cmd, window_cache_begin[m_selected_file].longFilename);

//check first for name validity
for (c = &cmd[0]; *c; c++)
{
if ((uint8_t)*c > 127)
{
return CacheEntryType_t::INVALID_NAME;
}
}

switch(window_cache_begin[m_selected_file].type)
{
//cases handled outside of SDCache
case FILE_ENTRY:
card.getfilename(m_index-1);
case BACK_ENTRY:
case BACK_ENTRY:
return window_cache_begin[m_selected_file].type;
break;

//Cases handled internally
case UPDIR_ENTRY:
case FOLDER_ENTRY:
changeDir();
return CacheEntryType_t::NOACTION;
break;
changeDir();
return CacheEntryType_t::NOACTION;
break;
}
}

Expand Down
1 change: 1 addition & 0 deletions Marlin/SDCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef enum
UPDIR_ENTRY,
FOLDER_ENTRY,
FILE_ENTRY,
INVALID_NAME,
} CacheEntryType_t;

typedef struct
Expand Down
114 changes: 114 additions & 0 deletions Marlin/StatsManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
///////////////////////////////////////////////////////////////////////////////
/// \file StatsManager.h
///
/// \author Koldo Imanol de Miguel
///
/// \brief Management class for management of printing statistics
///
/// Copyright (c) 2015 BQ - Mundo Reader S.L.
/// http://www.bq.com
///
/// This file is free software; you can redistribute it and/or modify
/// it under the terms of either the GNU General Public License version 2 or
/// later or the GNU Lesser General Public License version 2.1 or later, both
/// as published by the Free Software Foundation.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS IN THE SOFTWARE.
///////////////////////////////////////////////////////////////////////////////

#include "StatsManager.h"

#include "StorageManager.h"

StatsManager::StatsManager()
{ }

void StatsManager::loadStats()
{
m_hours = eeprom::StorageManager::single::instance().getStatHours();
m_minutes = eeprom::StorageManager::single::instance().getStatMinutes();
m_total_prints = eeprom::StorageManager::single::instance().getStatTotalPrints();
m_succeded = eeprom::StorageManager::single::instance().getStatSucceded();
}

void StatsManager::updateTotalTime(Time_t printTime)
{
uint16_t new_hours = m_hours + printTime.hours;

m_minutes += printTime.minutes;
if(m_minutes >= 60)
{
m_minutes -= 60;
++new_hours;
}

// check for time overflow
if(new_hours < m_hours)
{
resetStats();

//show only the data for the new print after overflow
m_hours = printTime.hours;
m_minutes = printTime.minutes;
increaseTotalPrints();
}
else
{
m_hours = new_hours;
}

//update time in memory
eeprom::StorageManager::single::instance().setStatHours(m_hours);
eeprom::StorageManager::single::instance().setStatMinutes(m_minutes);

}

void StatsManager::increaseTotalPrints()
{
++m_total_prints;

if(m_total_prints == 0xFFFF)
{
resetStats();
}
else
{
//update total prints in memory
eeprom::StorageManager::single::instance().setStatTotalPrints(m_total_prints);
}
}

void StatsManager::increaseSuccededPrints()
{
++m_succeded;

if(m_succeded == 0xFFFF)
{
resetStats();
}
else
{
//update succeded prints in memory
eeprom::StorageManager::single::instance().setStatSucceded(m_succeded);
}
}

void StatsManager::resetStats()
{
m_hours = 0;
m_minutes = 0;
m_total_prints = 0;
m_succeded = 0;

//update stats in memory
eeprom::StorageManager::single::instance().setStatHours(m_hours);
eeprom::StorageManager::single::instance().setStatMinutes(m_minutes);
eeprom::StorageManager::single::instance().setStatSucceded(m_succeded);
eeprom::StorageManager::single::instance().setStatTotalPrints(m_total_prints);
}
Loading

0 comments on commit 01f72a2

Please sign in to comment.