Commit 41fd5785 authored by MagoKimbra's avatar MagoKimbra

Update Nextion

parent 95bd6dbe
/**
* @file NexSlider.cpp
*
* The implementation of class NexSlider.
* The implementation of class NexSlider.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
......@@ -42,7 +42,7 @@ bool NexSlider::setValue(uint32_t number)
return recvRetCommandFinished();
}
bool NexSlider::setMaxValue(uint32_t number)
bool NexSlider::setMaxVal(uint32_t number)
{
char buf[10] = {0};
String cmd;
......@@ -56,7 +56,21 @@ bool NexSlider::setMaxValue(uint32_t number)
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};
String cmd;
......
/**
* @file NexSlider.h
*
* The definition of class NexSlider.
* The definition of class NexSlider.
*
* @author Wu Pengfei (email:<pengfei.wu@itead.cc>)
* @date 2015/8/13
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
......@@ -20,12 +20,12 @@
#include "NexTouch.h"
#include "NexHardware.h"
/**
* @addtogroup Component
* @{
* @addtogroup Component
* @{
*/
/**
* NexSlider component.
* NexSlider component.
*/
class NexSlider: public NexTouch
{
......@@ -36,44 +36,30 @@ public: /* methods */
NexSlider(uint8_t pid, uint8_t cid, const char *name);
/**
* Get the value of slider.
*
* @param number - an output parameter to save the value of slider.
*
* @retval true - success.
* @retval false - failed.
* Get the value of slider.
*
* @param number - an output parameter to save the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool getValue(uint32_t *number);
/**
* Set the value of slider.
*
* @param number - the value of slider.
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
* @retval true - success.
* @retval false - failed.
*/
bool setValue(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 setMaxVal(uint32_t number);
/**
* Set the hig of slider.
*
* @param number - the value of slider.
*
* @retval true - success.
* @retval false - failed.
*/
bool setHigValue(uint32_t number);
bool setMinVal(uint32_t number);
bool setHigVal(uint32_t number);
};
/**
* @}
......
......@@ -37,6 +37,7 @@ struct pin_map_t {
uint8_t const SDA_PIN = 20; // D1
uint8_t const SCL_PIN = 21; // D0
#undef SS_PIN
#undef MOSI_PIN
#undef MISO_PIN
#undef SCK_PIN
......
......@@ -24,7 +24,6 @@
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;
static millis_t next_lcd_update_ms;
static millis_t return_to_status_ms = 30000;
// Page
NexPage Pstart = NexPage(0, 0, "start");
......@@ -125,6 +124,55 @@
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() {
Pinfo.show();
......@@ -154,98 +202,18 @@
else
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) {
Folder1.setPic(18);
sdrow1.attachPop(sdfolderPopCallback, &sdrow1);
} else if (cmd == "") {
Folder1.setPic(17);
sdrow1.detachPop();
} else {
Folder1.setPic(17);
sdrow1.attachPop(sdfilePopCallback, &sdrow1);
}
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);
}
if (folder) {
folder_list[row]->setPic(18);
row_list[row]->attachPop(sdfolderPopCallback, row_list[row]);
} else if (cmd == "") {
folder_list[row]->setPic(17);
row_list[row]->detachPop();
} else {
folder_list[row]->setPic(17);
row_list[row]->attachPop(sdfilePopCallback, row_list[row]);
}
row_list[row]->setText(cmd);
filename_list[row]->setText(filename);
}
static void setrowsdcard(uint32_t number = 0) {
......@@ -288,8 +256,8 @@
uint16_t hig = 210 - slidermaxval * 10;
if (hig < 10) hig = 10;
sdlist.setHigValue(hig);
sdlist.setMaxValue(slidermaxval);
sdlist.setHigVal(hig);
sdlist.setMaxVal(slidermaxval);
sdlist.setValue(slidermaxval);
sendCommand("ref 0");
......@@ -503,32 +471,10 @@
else if (prc >= 95 && prc < 100)
color = 63488;
switch (h) {
case 0:
{
Hotend0.setText(buffer);
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;
}
}
hotend_list[h]->setText(buffer);
hotend_list[h]->setColor(color);
graph_list[h]->addValue(0, (int)(T1 * MaxWave));
graph_list[h]->addValue(1, (int)(T2 * MaxWave));
}
static void coordtoLCD() {
......@@ -605,9 +551,6 @@
#endif
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
return_to_status_ms = ms + 30000;
} else if (ms > return_to_status_ms && !PageInfo) {
setpageInfo();
}
}
......
......@@ -2509,24 +2509,24 @@
#define ORIG_X_STEP_PIN 96 // PB24
#define ORIG_X_DIR_PIN 2 // PB25
#define ORIG_X_ENABLE_PIN 24 // PA15, motor RESET pin
#define ORIG_X_MIN_PIN 33 // PC1
#define ORIG_X_MAX_PIN 34 // PC2
#define ORIG_X_MIN_PIN 33 // PC1
#define ORIG_X_MAX_PIN 34 // PC2
#define X_MS1_PIN 99 // PC10
// Y AXIS
#define ORIG_Y_STEP_PIN 94 // PB22
#define ORIG_Y_DIR_PIN 95 // PB23
#define ORIG_Y_ENABLE_PIN 24 // PA15, motor RESET pin
#define ORIG_Y_MIN_PIN 35 // PC3
#define ORIG_Y_MAX_PIN 37 // PC5
#define ORIG_Y_MIN_PIN 35 // PC3
#define ORIG_Y_MAX_PIN 37 // PC5
#define Y_MS1_PIN 10 // PC29
// Z AXIS
#define ORIG_Z_STEP_PIN 98 // PC27
#define ORIG_Z_DIR_PIN 3 // PC28
#define ORIG_Z_ENABLE_PIN 24 // PA15, motor RESET pin
#define ORIG_Z_MIN_PIN 38 // PC6
#define ORIG_Z_MAX_PIN 39 // PC7
#define ORIG_Z_MIN_PIN 38 // PC6
#define ORIG_Z_MAX_PIN 39 // PC7
#define Z_MS1_PIN 44 // PC19
// E0 AXIS
......@@ -5131,6 +5131,7 @@ DaveX plan for Teensylu/printrboard-type pinouts (ref teensylu & sprinter) for a
#define MOSI_PIN 51
#define MISO_PIN 50
#define SCK_PIN 52
#define SS_PIN 53
#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