diff --git a/software/sources/SolderingStation2_arduboy_gplib_v1.6L+.ino b/software/sources/SolderingStation2_arduboy_gplib_v1.6L+.ino index 4f07a36..bd09e1d 100644 --- a/software/sources/SolderingStation2_arduboy_gplib_v1.6L+.ino +++ b/software/sources/SolderingStation2_arduboy_gplib_v1.6L+.ino @@ -1,6 +1,7 @@ /*License: http://creativecommons.org/licenses/by-sa/3.0/ 采用CC3.0协议共享此程序 - 您可以自由地: + 您可以自由地:- + -AZ 共享 — 在任何媒介以任何形式复制、发行本作品 演绎 — 修改、转换或以本作品为基础进行创作 在任何用途下,甚至商业目的。 @@ -57,21 +58,21 @@ //const unsigned char QRCode[] PROGMEM = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x03, 0x86, 0x70, 0x80, 0x03, 0x80, 0x03, 0x86, 0x70, 0x80, 0x03, 0x9f, 0xf3, 0xe1, 0x30, 0x9f, 0xf3, 0x9f, 0xf3, 0xe1, 0x30, 0x9f, 0xf3, 0x98, 0x33, 0x01, 0xcc, 0x98, 0x33, 0x98, 0x33, 0x01, 0xcc, 0x98, 0x33, 0x98, 0x33, 0x87, 0xc0, 0x98, 0x33, 0x98, 0x33, 0xe1, 0xc0, 0x98, 0x33, 0x98, 0x33, 0xe1, 0xc0, 0x98, 0x33, 0x9f, 0xf3, 0x98, 0xc0, 0x9f, 0xf3, 0x9f, 0xf3, 0x98, 0xc0, 0x9f, 0xf3, 0x80, 0x03, 0x66, 0xcc, 0x80, 0x03, 0x80, 0x03, 0x66, 0xcc, 0x80, 0x03, 0xff, 0xff, 0x01, 0x0c, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x1f, 0xff, 0x81, 0x00, 0x61, 0x30, 0x1f, 0x3f, 0x87, 0x3c, 0xe6, 0xfc, 0x87, 0x33, 0x87, 0x3c, 0xe6, 0xfc, 0x87, 0xf3, 0xf8, 0x03, 0x9e, 0x0f, 0x1f, 0x03, 0xf8, 0x03, 0x9e, 0x0f, 0x1f, 0x03, 0xe1, 0x3c, 0xfe, 0x0c, 0x07, 0xcf, 0xe1, 0x3c, 0xfe, 0x0c, 0x07, 0xcf, 0x99, 0x03, 0x3e, 0x30, 0x86, 0xc3, 0xe6, 0xcf, 0x38, 0x0f, 0x9e, 0xf3, 0xe6, 0xcf, 0x38, 0x0f, 0x9e, 0xf3, 0x9e, 0x03, 0x27, 0xcc, 0x81, 0x03, 0x9e, 0x03, 0x27, 0xcc, 0x81, 0x03, 0xe0, 0xff, 0xe1, 0x0c, 0xe6, 0xcf, 0xe0, 0xff, 0xe1, 0x0c, 0xe6, 0xcf, 0x98, 0x03, 0x06, 0x00, 0x00, 0xff, 0x98, 0x03, 0x06, 0x00, 0x00, 0xff, 0xff, 0xff, 0x1e, 0xf0, 0xf8, 0x03, 0x80, 0x03, 0x66, 0x30, 0x99, 0xc3, 0x80, 0x03, 0x66, 0x30, 0x99, 0xc3, 0x9f, 0xf3, 0x01, 0x0c, 0xf8, 0xff, 0x9f, 0xf3, 0x01, 0x0c, 0xf8, 0xff, 0x98, 0x33, 0x39, 0x3c, 0x01, 0xcf, 0x98, 0x33, 0x39, 0x3c, 0x01, 0xcf, 0x98, 0x33, 0xff, 0x0c, 0x79, 0x3f, 0x98, 0x33, 0x3e, 0xcc, 0xe0, 0xf3, 0x98, 0x33, 0x3e, 0xcc, 0xe0, 0xf3, 0x9f, 0xf3, 0x3e, 0x00, 0x98, 0xcf, 0x9f, 0xf3, 0x3e, 0x00, 0x98, 0xcf, 0x80, 0x03, 0x3e, 0x30, 0xe7, 0xc3, 0x80, 0x03, 0x3e, 0x30, 0xe7, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; //ICO //width:16,height:16 -const unsigned char Tag[] PROGMEM = { 0x00, 0x00, 0x7e, 0x00, 0x7f, 0x00, 0x73, 0x80, 0x61, 0xc0, 0x61, 0xe0, 0x73, 0xf0, 0x3f, 0xf8, 0x1f, 0xfc, 0x0f, 0xfe, 0x07, 0xff, 0x03, 0xff, 0x01, 0xfe, 0x00, 0xfc, 0x00, 0x78, 0x00, 0x30 }; -const unsigned char Chip[] PROGMEM = { 0x12, 0x48, 0x12, 0x48, 0x1f, 0xf8, 0xe0, 0x07, 0x2e, 0x14, 0x2c, 0x04, 0xe8, 0x07, 0x20, 0x04, 0x20, 0x04, 0xe0, 0x07, 0x20, 0x04, 0x28, 0x14, 0xe0, 0x07, 0x1f, 0xf8, 0x12, 0x48, 0x12, 0x48 }; +const unsigned char Tag[] PROGMEM = { 0x00,0x00,0x3b,0xec,0x7b,0xee,0x63,0xe6,0x63,0xe6,0x63,0xe6,0x63,0xe6,0x63,0xe6,0x63,0xe6,0x63,0x66,0x62,0x26,0x60,0x06,0x60,0x06,0x7f,0xfe,0x3f,0xfc,0x00,0x00 }; +const unsigned char Chip[] PROGMEM = { 0x14,0xa0,0x3f,0xf0,0x7f,0xf8,0xe0,0x1c,0x6e,0x18,0xec,0x1c,0x68,0x18,0x60,0x18,0xe0,0x1c,0x60,0x58,0xe0,0x1c,0x7f,0xf8,0x3f,0xf0,0x14,0xa0 }; //const unsigned char HeatPipe[] PROGMEM = { 0x00, 0x00, 0x09, 0x90, 0x11, 0x88, 0x21, 0x84, 0x11, 0x88, 0x09, 0x90, 0x11, 0x88, 0x21, 0x84, 0x11, 0x88, 0x09, 0x90, 0x11, 0x88, 0x21, 0x84, 0x11, 0x88, 0x09, 0x90, 0x01, 0x80, 0x00, 0x00 }; -const unsigned char Lightning[] PROGMEM = { 0x00, 0x80, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x03, 0x80, 0x07, 0x80, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xe0, 0x1f, 0xc0, 0x01, 0xc0, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x01, 0x00 }; +const unsigned char Lightning[] PROGMEM = { 0x0f,0xe0,0x1f,0xc0,0x1f,0xc0,0x3f,0x80,0x3f,0xf8,0x7f,0xf0,0x7f,0xe0,0x07,0xc0,0x07,0x80,0x0f,0x00,0x0e,0x00,0x1c,0x00,0x18,0x00,0x10,0x00 }; //const unsigned char Thermometer[] PROGMEM = { 0x01, 0x80, 0x02, 0x40, 0x03, 0x40, 0x02, 0x40, 0x03, 0x40, 0x02, 0x40, 0x03, 0x40, 0x02, 0x40, 0x03, 0x40, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x07, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x03, 0xc0 }; const unsigned char Pointer[] PROGMEM = { 0x20, 0x20, 0x70, 0xf8 }; //状态提示 -//width:16,height:16 图标库 -const unsigned char c1[] PROGMEM = { 0x03, 0x80, 0x03, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, 0xe0, 0x0e, 0x70, 0x1e, 0x70, 0x1e, 0x70, 0x1e, 0x78, 0x3f, 0xf8, 0x3f, 0xfc, 0x7e, 0x7c, 0x7e, 0x7e, 0x7f, 0xfe, 0x7f, 0xfe }; -const unsigned char c2[] PROGMEM = { 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x19, 0x90, 0x39, 0xb8, 0x31, 0x8c, 0x61, 0x8c, 0x61, 0x86, 0x60, 0x06, 0x60, 0x06, 0x60, 0x0e, 0x70, 0x0c, 0x30, 0x1c, 0x1c, 0x78, 0x0f, 0xf0, 0x03, 0xc0 }; -const unsigned char c3[] PROGMEM = { 0x00, 0xe0, 0x03, 0xc0, 0x0f, 0x00, 0x1c, 0x38, 0x10, 0xf0, 0x03, 0xc0, 0x0f, 0x00, 0x1c, 0x38, 0x10, 0xf0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x03, 0x80 }; -//c4用Lightning 替代 -const unsigned char c5[] PROGMEM = { 0x0f, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, 0xff, 0xe6, 0xff, 0xce, 0xff, 0x9f, 0xf3, 0x3f, 0xf0, 0x7f, 0xf8, 0xff, 0xfd, 0xfe, 0x7f, 0xfe, 0x7f, 0xfc, 0x3f, 0xf8, 0x1f, 0xf0, 0x03, 0xc0 }; -const unsigned char c6[] PROGMEM = { 0x04, 0x00, 0x06, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x0f, 0x80, 0x1f, 0x80, 0x3f, 0x90, 0x7f, 0x18, 0x7f, 0x1c, 0x7e, 0x3c, 0x7c, 0x3e, 0x78, 0x7e, 0x78, 0xfe, 0x31, 0xfe, 0x11, 0xfc, 0x09, 0xf8 }; -const unsigned char c7[] PROGMEM = { 0x00, 0x00, 0x07, 0xe0, 0x1f, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x3f, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, 0x7c, 0x3e, 0x7c, 0x3f, 0xfc, 0x3f, 0xfc, 0x00, 0x00 }; +//width:14,height:14 图标库 + +const unsigned char c1[] PROGMEM = { 0x03,0x00,0x07,0x80,0x0f,0xc0,0x0c,0xc0,0x1c,0xe0,0x1c,0xe0,0x3c,0xf0,0x3c,0xf0,0x7f,0xf8,0x7f,0xf8,0xfc,0xfc,0xfc,0xfc,0xff,0xfc,0x7f,0xf8 }; +const unsigned char c2[] PROGMEM = { 0x7f,0xf8,0xff,0xfc,0xc0,0x0c,0xc3,0x0c,0xcb,0x4c,0xdb,0x6c,0xdb,0x6c,0xd8,0x6c,0xdc,0xec,0xcf,0xcc,0xc7,0x8c,0xc0,0x0c,0xff,0xfc,0x7f,0xf8 }; +const unsigned char c3[] PROGMEM = { 0x00,0x00,0x06,0x00,0x0c,0x00,0x18,0xf8,0x38,0xf0,0x30,0x30,0x70,0x60,0x70,0x78,0x78,0xf8,0x78,0x00,0x3c,0x02,0x3f,0x0c,0x1f,0xf8,0x0f,0xf0,0x03,0xc0,0x00,0x00 }; +const unsigned char c5[] PROGMEM = { 0x7f,0xf0,0xff,0xe0,0xc0,0x08,0xc0,0x1c,0xc0,0x38,0xc8,0x70,0xdc,0xe4,0xcf,0xcc,0xc7,0x8c,0xc3,0x0c,0xc0,0x0c,0xc0,0x0c,0xff,0xfc,0x7f,0xf8 }; +const unsigned char c6[] PROGMEM = { 0x1e,0x10,0x33,0x38,0x2d,0x7c,0x25,0x38,0x2d,0x38,0x25,0x38,0x2d,0x38,0x6d,0x80,0xde,0xc0,0xbf,0x40,0xbf,0x40,0xde,0xc0,0x61,0x80,0x3f,0x00 }; +const unsigned char c7[] PROGMEM = { 0x1f,0xe0,0x3f,0xf0,0x70,0x38,0x60,0x18,0x60,0x18,0x60,0x18,0xff,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xf8,0x7c,0xf8,0x7c,0xfc,0xfc,0x7f,0xf8 }; // width: 48, height: 48 const unsigned char c_OK[] PROGMEM = { 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xff, 0xc0, 0x03, 0xff, 0xfe, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x20, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x70, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0xf0, 0x00, 0x00, 0x01, 0xf8, 0x0f, 0xf0, 0x00, 0x00, 0x03, 0xf0, 0x0f, 0xf0, 0x00, 0x00, 0x07, 0xe0, 0x0f, 0xf0, 0x00, 0x00, 0x0f, 0xc0, 0x0f, 0xe0, 0x00, 0x00, 0x1f, 0x80, 0x07, 0xe0, 0x01, 0x80, 0x3f, 0x00, 0x07, 0xe0, 0x03, 0xc0, 0x7e, 0x00, 0x07, 0xe0, 0x07, 0xe0, 0xfc, 0x00, 0x07, 0xe0, 0x03, 0xf1, 0xf8, 0x00, 0x07, 0xe0, 0x01, 0xff, 0xf0, 0x00, 0x07, 0xe0, 0x00, 0xff, 0xe0, 0x00, 0x07, 0xe0, 0x00, 0x7f, 0xc0, 0x00, 0x07, 0xf0, 0x00, 0x3f, 0x80, 0x00, 0x0f, 0xf0, 0x00, 0x1f, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x0e, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x04, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x03, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x07, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xf0, 0x0f, 0xff, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xf0 }; // width: 48, height: 48 @@ -276,7 +277,7 @@ Arduboy2 arduboy; #include // Firmware version -#define VERSION "v1.6L1" +#define VERSION "v1.6L+" // Type of rotary encoder #define ROTARY_TYPE 1 // 0: 2 increments/step; 1: 4 increments/step @@ -292,6 +293,7 @@ Arduboy2 arduboy; #define SWITCH_PIN 10 // handle vibration switch // Default temperature control values (recommended soldering temperature: 300-380°C) +#define ChipTempCalVal 330 //芯片内部温度读取校准值 -->可以根据实际情况修改,不同机器情况不同,通常误差在10°C内 #define TEMP_MIN 50 // min selectable temperature #define TEMP_MAX 400 // max selectable temperature #define TEMP_DEFAULT 320 // default start setpoint @@ -781,14 +783,14 @@ void MainScreen() { default: arduboy.print(F("ERROR")); break; } break; } - arduboy.drawSlowXYBitmap(112, 0, C_table[SysState], 16, 16, 0); + arduboy.drawSlowXYBitmap(113, 1, C_table[SysState], 14, 14, 0); arduboy.setTextSize(1); //芯片 //R1 - if (getChipTemp() >80 && ((millis()*4) / 1000) % 2) beep(); else arduboy.drawSlowXYBitmap(0, 16, Chip, 16, 16, 0); + if (getChipTemp() >80 && ((millis()*4) / 1000) % 2) beep(); else arduboy.drawSlowXYBitmap(2, 18, Chip, 14, 14, 0); //R2 - if ((float)Vin / 100 < UnderVoltage && ((millis()*4) / 1000) % 2) beep(); else arduboy.drawSlowXYBitmap(0, 32, Lightning, 16, 16, 0); + if ((float)Vin / 100 < UnderVoltage && ((millis()*4) / 1000) % 2) beep(); else arduboy.drawSlowXYBitmap(2, 34, Lightning, 14, 14, 0); //R3 arduboy.setCursor(19, 16); arduboy.print(getChipTemp(), 1); arduboy.print((char)248); arduboy.print(F("C")); //芯片温度 arduboy.setCursor(19, 24); arduboy.print((float)getVCC() / 1000, 2); arduboy.print(F("V")); //芯片电压 @@ -1227,8 +1229,23 @@ uint16_t denoiseAnalog (byte port) { return (result >> 5); // devide by 32 and return value } - +//读取芯片温度 // get internal temperature by reading ADC channel 8 against 1.1V reference +double getChipTemp() { +unsigned int wADC; +double t; +ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3)); +ADCSRA |= _BV(ADEN); +delay(5); +ADCSRA |= _BV(ADSC); +while (bit_is_set(ADCSRA,ADSC)); +wADC = ADCW; +t = (wADC - ChipTempCalVal ) / 1.22; +return (t); +} + +/* + * // get internal temperature by reading ADC channel 8 against 1.1V reference double getChipTemp() { uint16_t result = 0; ADCSRA |= bit (ADEN) | bit (ADIF); // enable ADC, turn off any pending interrupt @@ -1244,8 +1261,7 @@ double getChipTemp() { result >>= 2; // devide by 4 return ((result - 2594) / 9.76); // calculate internal temperature in degrees C } - - + */ // get input voltage in mV by reading 1.1V reference against AVcc uint16_t getVCC() { uint16_t result = 0;