Commit 41fd5785 authored by MagoKimbra's avatar MagoKimbra

Update Nextion

parent 95bd6dbe
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>) * @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13 * @date 2015/8/13
* @copyright * @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
...@@ -42,7 +42,7 @@ bool NexSlider::setValue(uint32_t number) ...@@ -42,7 +42,7 @@ bool NexSlider::setValue(uint32_t number)
return recvRetCommandFinished(); return recvRetCommandFinished();
} }
bool NexSlider::setMaxValue(uint32_t number) bool NexSlider::setMaxVal(uint32_t number)
{ {
char buf[10] = {0}; char buf[10] = {0};
String cmd; String cmd;
...@@ -56,7 +56,21 @@ bool NexSlider::setMaxValue(uint32_t number) ...@@ -56,7 +56,21 @@ bool NexSlider::setMaxValue(uint32_t number)
return recvRetCommandFinished(); return recvRetCommandFinished();
} }
bool NexSlider::setHigValue(uint32_t number) bool NexSlider::setMinVal(uint32_t number)
{
char buf[10] = {0};
String cmd;
utoa(number, buf, 10);
cmd += getObjName();
cmd += ".minval=";
cmd += buf;
sendCommand(cmd.c_str());
return recvRetCommandFinished();
}
bool NexSlider::setHigVal(uint32_t number)
{ {
char buf[10] = {0}; char buf[10] = {0};
String cmd; String cmd;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @date 2015/8/13 * @date 2015/8/13
* *
* @copyright * @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of * published by the Free Software Foundation; either version 2 of
...@@ -55,25 +55,11 @@ public: /* methods */ ...@@ -55,25 +55,11 @@ public: /* methods */
*/ */
bool setValue(uint32_t number); bool setValue(uint32_t number);
/** bool setMaxVal(uint32_t number);
* Set the maxvalue of slider.
*
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool setMaxValue(uint32_t number);
/** bool setMinVal(uint32_t number);
* Set the hig of slider.
* bool setHigVal(uint32_t number);
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool setHigValue(uint32_t number);
}; };
/** /**
* @} * @}
......
...@@ -37,6 +37,7 @@ struct pin_map_t { ...@@ -37,6 +37,7 @@ struct pin_map_t {
uint8_t const SDA_PIN = 20; // D1 uint8_t const SDA_PIN = 20; // D1
uint8_t const SCL_PIN = 21; // D0 uint8_t const SCL_PIN = 21; // D0
#undef SS_PIN
#undef MOSI_PIN #undef MOSI_PIN
#undef MISO_PIN #undef MISO_PIN
#undef SCK_PIN #undef SCK_PIN
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
char lcd_status_message[30] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 char lcd_status_message[30] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
uint8_t lcd_status_message_level = 0; uint8_t lcd_status_message_level = 0;
static millis_t next_lcd_update_ms; static millis_t next_lcd_update_ms;
static millis_t return_to_status_ms = 30000;
// Page // Page
NexPage Pstart = NexPage(0, 0, "start"); NexPage Pstart = NexPage(0, 0, "start");
...@@ -125,6 +124,55 @@ ...@@ -125,6 +124,55 @@
NULL NULL
}; };
NexText *hotend_list[] =
{
&Hotend0,
&Hotend1,
&Hotend2,
NULL
};
NexWaveform *graph_list[] =
{
&Graph0,
&Graph1,
&Graph2,
NULL
};
NexText *row_list[] =
{
&sdrow0,
&sdrow1,
&sdrow2,
&sdrow3,
&sdrow4,
&sdrow5,
NULL
};
NexPicture *folder_list[] =
{
&Folder0,
&Folder1,
&Folder2,
&Folder3,
&Folder4,
&Folder5,
NULL
};
NexVar *filename_list[] =
{
&filename0,
&filename1,
&filename2,
&filename3,
&filename4,
&filename5,
NULL
};
void setpageInfo() { void setpageInfo() {
Pinfo.show(); Pinfo.show();
...@@ -154,98 +202,18 @@ ...@@ -154,98 +202,18 @@
else else
cmd = filename; cmd = filename;
switch (row) {
case 0:
{
if (folder) {
Folder0.setPic(18);
sdrow0.attachPop(sdfolderPopCallback, &sdrow0);
} else if (cmd == "") {
Folder0.setPic(17);
sdrow0.detachPop();
} else {
Folder0.setPic(17);
sdrow0.attachPop(sdfilePopCallback, &sdrow0);
}
sdrow0.setText(cmd);
filename0.setText(filename);
}
case 1:
{
if (folder) { if (folder) {
Folder1.setPic(18); folder_list[row]->setPic(18);
sdrow1.attachPop(sdfolderPopCallback, &sdrow1); row_list[row]->attachPop(sdfolderPopCallback, row_list[row]);
} else if (cmd == "") { } else if (cmd == "") {
Folder1.setPic(17); folder_list[row]->setPic(17);
sdrow1.detachPop(); row_list[row]->detachPop();
} else { } else {
Folder1.setPic(17); folder_list[row]->setPic(17);
sdrow1.attachPop(sdfilePopCallback, &sdrow1); row_list[row]->attachPop(sdfilePopCallback, row_list[row]);
}
sdrow1.setText(cmd);
filename1.setText(filename);
}
case 2:
{
if (folder) {
Folder2.setPic(18);
sdrow2.attachPop(sdfolderPopCallback, &sdrow2);
} else if (cmd == "") {
Folder2.setPic(17);
sdrow2.detachPop();
} else {
Folder2.setPic(17);
sdrow2.attachPop(sdfilePopCallback, &sdrow2);
}
sdrow2.setText(cmd);
filename2.setText(filename);
}
case 3:
{
if (folder) {
Folder3.setPic(18);
sdrow3.attachPop(sdfolderPopCallback, &sdrow3);
} else if (cmd == "") {
Folder3.setPic(17);
sdrow3.detachPop();
} else {
Folder3.setPic(17);
sdrow3.attachPop(sdfilePopCallback, &sdrow3);
}
sdrow3.setText(cmd);
filename3.setText(filename);
}
case 4:
{
if (folder) {
Folder4.setPic(18);
sdrow4.attachPop(sdfolderPopCallback, &sdrow4);
} else if (cmd == "") {
Folder4.setPic(17);
sdrow4.detachPop();
} else {
Folder4.setPic(17);
sdrow4.attachPop(sdfilePopCallback, &sdrow4);
}
sdrow4.setText(cmd);
filename4.setText(filename);
}
case 5:
{
if (folder) {
Folder5.setPic(18);
sdrow5.attachPop(sdfolderPopCallback, &sdrow5);
} else if (cmd == "") {
Folder5.setPic(17);
sdrow5.detachPop();
} else {
Folder5.setPic(17);
sdrow5.attachPop(sdfilePopCallback, &sdrow5);
}
sdrow5.setText(cmd);
filename5.setText(filename);
}
} }
row_list[row]->setText(cmd);
filename_list[row]->setText(filename);
} }
static void setrowsdcard(uint32_t number = 0) { static void setrowsdcard(uint32_t number = 0) {
...@@ -288,8 +256,8 @@ ...@@ -288,8 +256,8 @@
uint16_t hig = 210 - slidermaxval * 10; uint16_t hig = 210 - slidermaxval * 10;
if (hig < 10) hig = 10; if (hig < 10) hig = 10;
sdlist.setHigValue(hig); sdlist.setHigVal(hig);
sdlist.setMaxValue(slidermaxval); sdlist.setMaxVal(slidermaxval);
sdlist.setValue(slidermaxval); sdlist.setValue(slidermaxval);
sendCommand("ref 0"); sendCommand("ref 0");
...@@ -503,32 +471,10 @@ ...@@ -503,32 +471,10 @@
else if (prc >= 95 && prc < 100) else if (prc >= 95 && prc < 100)
color = 63488; color = 63488;
switch (h) { hotend_list[h]->setText(buffer);
case 0: hotend_list[h]->setColor(color);
{ graph_list[h]->addValue(0, (int)(T1 * MaxWave));
Hotend0.setText(buffer); graph_list[h]->addValue(1, (int)(T2 * MaxWave));
Hotend0.setColor(color);
Graph0.addValue(0, (int)(T1 * MaxWave));
Graph0.addValue(1, (int)(T2 * MaxWave));
break;
}
case 1:
{
Hotend1.setText(buffer);
Hotend1.setColor(color);
Graph1.addValue(0, (int)(T1 * MaxWave));
Graph1.addValue(1, (int)(T2 * MaxWave));
break;
}
case 2:
{
Hotend2.setText(buffer);
Hotend2.setColor(color);
Graph2.addValue(0, (int)(T1 * MaxWave));
Graph2.addValue(1, (int)(T2 * MaxWave));
break;
}
}
} }
static void coordtoLCD() { static void coordtoLCD() {
...@@ -605,9 +551,6 @@ ...@@ -605,9 +551,6 @@
#endif #endif
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
return_to_status_ms = ms + 30000;
} else if (ms > return_to_status_ms && !PageInfo) {
setpageInfo();
} }
} }
......
...@@ -5131,6 +5131,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a ...@@ -5131,6 +5131,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define MOSI_PIN 51 #define MOSI_PIN 51
#define MISO_PIN 50 #define MISO_PIN 50
#define SCK_PIN 52 #define SCK_PIN 52
#define SS_PIN 53
#endif #endif
/****************************************************************************************/ /****************************************************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment