本文整理汇总了C++中NexText类的典型用法代码示例。如果您正苦于以下问题:C++ NexText类的具体用法?C++ NexText怎么用?C++ NexText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NexText类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: coordtoLCD
static void coordtoLCD() {
char* valuetemp;
memset(buffer, 0, sizeof(buffer));
strcat(buffer, TEST(axis_known_position, X_AXIS) || !TEST(axis_was_homed, X_AXIS) ? "X" : "?");
if (TEST(axis_was_homed, X_AXIS)) {
valuetemp = ftostr4sign(current_position[X_AXIS]);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
strcat(buffer, TEST(axis_known_position, Y_AXIS) || !TEST(axis_was_homed, Y_AXIS) ? PSTR(" Y") : PSTR(" ?"));
if (TEST(axis_was_homed, Y_AXIS)) {
valuetemp = ftostr4sign(current_position[Y_AXIS]);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
strcat(buffer, TEST(axis_known_position, Z_AXIS) || !TEST(axis_was_homed, Z_AXIS) ? PSTR(" Z ") : PSTR("? "));
if (TEST(axis_was_homed, Z_AXIS)) {
valuetemp = ftostr32sp(current_position[Z_AXIS] + 0.00001);
strcat(buffer, valuetemp);
}
else
strcat(buffer, "---");
LedCoord1.setText(buffer);
LedCoord6.setText(buffer);
}
示例2: setrowsdcard
static void setrowsdcard(uint32_t number = 0) {
uint16_t fileCnt = card.getnrfilenames();
uint32_t i = 0;
card.getWorkDirName();
if (fullName[0] != '/') {
Folderup.setShow();
Folderup.attachPop(sdfolderUpPopCallback);
sdfolder.setText(fullName);
} else {
Folderup.detachPop();
Folderup.setHide();
sdfolder.setText("");
}
for (uint8_t row = 0; row < 6; row++) {
i = row + number;
if (i < fileCnt) {
card.getfilename(i);
printrowsd(row, card.filenameIsDir, fullName);
} else {
printrowsd(row, false, "");
}
}
sendCommand("ref 0");
}
示例3: lcd_setstatuspgm
void lcd_setstatuspgm(const char* message, uint8_t level) {
if (level >= lcd_status_message_level && NextionON) {
strncpy_P(lcd_status_message, message, 30);
lcd_status_message_level = level;
LedStatus.setText(lcd_status_message);
}
}
示例4: settempPopCallback
void settempPopCallback(void *ptr) {
uint16_t number;
memset(buffer, 0, sizeof(buffer));
set0.getText(buffer, sizeof(buffer));
number = atoi(buffer);
if (ptr == &tup) number += 1;
if (ptr == &tdown) number -= 1;
memset(buffer, 0, sizeof(buffer));
itoa(number, buffer, 10);
set0.setText(buffer);
}
示例5: hotPopCallback
void hotPopCallback(void *ptr) {
Ptemp.show();
memset(buffer, 0, sizeof(buffer));
if (ptr == &hot0) {
if (degTargetHotend(0) != 0) {
itoa(degTargetHotend(0), buffer, 10);
}
set1.setText("M104 T0 S");
}
if (ptr == &hot1) {
if (degTargetHotend(1) != 0) {
itoa(degTargetHotend(1), buffer, 10);
}
set1.setText("M104 T1 S");
}
#if HAS_TEMP_2
if (ptr == &hot2) {
if (degTargetHotend(2) != 0) {
itoa(degTargetHotend(2), buffer, 10);
}
set1.setText("M104 T2 S");
}
#elif HAS_TEMP_BED
if (ptr == &hot2) {
if (degTargetBed() != 0) {
itoa(degTargetBed(), buffer, 10);
}
set1.setText("M140 S");
}
#endif
set0.setText(buffer);
}
示例6: refreshScreen
/* Refreshing part of the screen items */
void refreshScreen(int screen) {
dbSerialPrintln("refreshScreen");
switch(screen) {
case HOME_SCREEN:
/* Refresh outside temporary */
char bufTemp[10];
if(tempScale == 0)
sprintf(bufTemp, "%.1f", currentOutsideTemperatureC);
else
sprintf(bufTemp, "%.1f", currentOutsideTemperatureC * 1.8 + 32); // Celsius to Fahrenheit conversion
t0.setText(bufTemp);
/* Refresh outside humidity */
char bufHumid[10];;
sprintf(bufHumid, "%.1f", currentOutsideHumidity);
t8.setText(bufHumid);
break;
case SECOND_SCREEN:
/* TBD */
break;
}
}
示例7: sdfolderPopCallback
void sdfolderPopCallback(void *ptr) {
memset(buffer, 0, sizeof(buffer));
if (ptr == &sdrow0)
sdrow0.getText(buffer, sizeof(buffer));
else if (ptr == &sdrow1)
sdrow1.getText(buffer, sizeof(buffer));
else if (ptr == &sdrow2)
sdrow2.getText(buffer, sizeof(buffer));
else if (ptr == &sdrow3)
sdrow3.getText(buffer, sizeof(buffer));
else if (ptr == &sdrow4)
sdrow4.getText(buffer, sizeof(buffer));
else if (ptr == &sdrow5)
sdrow5.getText(buffer, sizeof(buffer));
menu_action_sddirectory(buffer);
}
示例8: setpageInfo
void setpageInfo() {
if (NextionPage == 0) {
Pinfo.show();
#if HAS(TEMP_0)
Hotend.setValue(1);
#endif
#if HAS(TEMP_1)
Hotend.setValue(2);
#endif
#if HAS(TEMP_2)
Hotend.setValue(3);
#elif HAS(TEMP_BED)
Bed.setValue(1);
Hotend21.setText("BED");
#endif
VSpeed.setValue(100);
#if HAS(FAN)
Fan.setValue(1);
#endif
lcd_setstatus(lcd_status_message);
}
Pinfo.show();
#if ENABLED(NEXTION_GFX)
#if MECH(DELTA)
gfx_clear((X_MAX_POS) * 2, (Y_MAX_POS) * 2, Z_MAX_POS);
#else
gfx_clear(X_MAX_POS, Y_MAX_POS, Z_MAX_POS);
#endif
#endif
}
示例9: setpageInfo
void setpageInfo() {
Pinfo.show();
PageInfo = true;
#if ENABLED(NEXTION_GFX)
gfx_clear(X_MAX_POS, Y_MAX_POS, Z_MAX_POS);
#endif
#if HAS_TEMP_0
Hotend.setValue(1);
#endif
#if HAS_TEMP_1
Hotend.setValue(2);
#endif
#if HAS_TEMP_2
Hotend.setValue(3);
#elif HAS_TEMP_BED
Hotend21.setText("BED");
Bed.setValue(1);
#endif
lcd_setstatus(lcd_status_message);
}
示例10: renderHomeScreen
/* Rendering home screen */
void renderHomeScreen() {
dbSerialPrintln("renderHomeScreen");
writeLocation();
// Render outside temperature
char bufTemp[10];
if(tempScale == 0)
sprintf(bufTemp, "%.1f", currentOutsideTemperatureC);
else {
sprintf(bufTemp, "%.1f", currentOutsideTemperatureC * 1.8 + 32); // Celsius to Fahrenheit conversion
dbSerialPrint("Temp in F: ");
dbSerialPrintln(bufTemp);
}
t0.setText(bufTemp);
// Render outside humidity
char bufHumid[10];;
sprintf(bufHumid, "%.1f", currentOutsideHumidity);
t8.setText(bufHumid);
// Render correct temperature scale based on the selection
if(tempScale == 0) {
t1.setText("°C");
t4.setText("°C");
t13.setText("°C");
t15.setText("°C");
t17.setText("°C");
t19.setText("°C");
t21.setText("°C");
t23.setText("°C");
}
else {
t1.setText("F");
t4.setText("F");
t13.setText("F");
t15.setText("F");
t17.setText("F");
t19.setText("F");
t21.setText("F");
t23.setText("F");
}
/* Render days of week for forecast
dbSerialPrint("Time: ");
dbSerialPrint(Time.hour());
dbSerialPrint(":");
dbSerialPrintln(Time.minute());
dbSerialPrint("Day of week: ");
dbSerialPrintln(Time.weekday());*/
int day = 0;
while(day < 4) {
// Icons for all days
dbSerialPrintln("weatherData[" + String(day) + "]: " + String(weatherData[day].icon));
if(weatherData[day].icon > 0) {
if(day == 0)
p0.setPic(weatherData[day].icon);
else if(day == 1)
p1.setPic(weatherData[day].icon);
else if(day == 2)
p2.setPic(weatherData[day].icon);
else if(day == 3)
p3.setPic(weatherData[day].icon);
}
// Day + 1 forecast info
if(day == 1) {
if(langCode==0)
t5.setText(daysOfWeek_en[weatherData[day].weekday]);
else
t5.setText(daysOfWeek_fi[weatherData[day].weekday]);
if(tempScale == 0)
t12.setText(String(weatherData[day].minTemp));
else
t12.setText(String((int)round(weatherData[day].minTemp * 1.8 + 32)));
if(tempScale == 0)
t14.setText(String(weatherData[day].maxTemp));
else
t14.setText(String((int)round(weatherData[day].maxTemp * 1.8 + 32)));
}
// Day + 2 forecast info
else if(day == 2) {
if(langCode==0)
t6.setText(daysOfWeek_en[weatherData[day].weekday]);
else
t6.setText(daysOfWeek_fi[weatherData[day].weekday]);
//t16.setText(String(weatherData[day].minTemp));
//t18.setText(String(weatherData[day].maxTemp));
if(tempScale == 0)
t16.setText(String(weatherData[day].minTemp));
else
t16.setText(String((int)round(weatherData[day].minTemp * 1.8 + 32)));
if(tempScale == 0)
t18.setText(String(weatherData[day].maxTemp));
else
//.........这里部分代码省略.........
示例11: writeLocation
/* Write Location to the home screen */
void writeLocation()
{
dbSerialPrintln("writeLocation");
dbSerialPrintln("Koivukehä");
t2.setText("Koivukehä");
}
示例12: lcd_setstatus
void lcd_setstatus(const char* message, bool persist) {
if (lcd_status_message_level > 0 || !NextionON) return;
strncpy(lcd_status_message, message, 30);
LedStatus.setText(lcd_status_message);
}
示例13: setgcodePopCallback
void setgcodePopCallback(void *ptr) {
memset(buffer, 0, sizeof(buffer));
Tgcode.getText(buffer, sizeof(buffer));
enqueue_and_echo_commands_P(buffer);
Pmenu.show();
}