|
@@ -70,7 +70,7 @@ int main(void) {
|
|
/*
|
|
/*
|
|
* Creates the blinker thread.
|
|
* Creates the blinker thread.
|
|
*/
|
|
*/
|
|
- //chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
|
|
|
|
|
+ chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Buttons
|
|
* Buttons
|
|
@@ -89,30 +89,27 @@ int main(void) {
|
|
/*
|
|
/*
|
|
* Normal main() thread activity.
|
|
* Normal main() thread activity.
|
|
*/
|
|
*/
|
|
- ST7735_WriteString(0, 20, "onewireTest...", LiberM_7x10, Blue, Black);
|
|
|
|
- onewireTest();
|
|
|
|
|
|
+ ST7735_WriteString(0, LCD_LINE_1, "OneWire search...", LiberM_7x10, Blue, Black);
|
|
|
|
+ onewireMeasure();
|
|
int32_t t;
|
|
int32_t t;
|
|
int n = onewireGetDevicesNum();
|
|
int n = onewireGetDevicesNum();
|
|
chsnprintf(buf, 22, "Found %d device[s]", n);
|
|
chsnprintf(buf, 22, "Found %d device[s]", n);
|
|
- ST7735_WriteString(0, 80, buf, LiberM_7x10, Cyan, Black);
|
|
|
|
- if (n != 0) {
|
|
|
|
- t = onewireGetTemperature(1);
|
|
|
|
- chsnprintf(buf, 22, " T = %d °C ", t);
|
|
|
|
- ST7735_WriteString(0, 20, buf, LiberM_7x10, Yellow, Black);
|
|
|
|
- } else {
|
|
|
|
- ST7735_WriteString(0, 20, "DS18B20 not found.", LiberM_7x10, Red, Black);
|
|
|
|
|
|
+ ST7735_WriteString(0, LCD_LINE_1, buf, LiberM_7x10, Cyan, Black);
|
|
|
|
+ chThdSleepMilliseconds(2000);
|
|
|
|
+ if (n == 0) {
|
|
|
|
+ ST7735_WriteString(0, LCD_LINE_1, "DS18B20 not found.", LiberM_7x10, Red, Black);
|
|
}
|
|
}
|
|
|
|
|
|
int a, b;
|
|
int a, b;
|
|
while (true) {
|
|
while (true) {
|
|
- chThdSleepMilliseconds(1000);
|
|
|
|
if (n != 0) {
|
|
if (n != 0) {
|
|
- onewireTest();
|
|
|
|
- t = onewireGetTemperature(1);
|
|
|
|
|
|
+ onewireMeasure();
|
|
|
|
+ t = onewireGetTemperature(0);
|
|
a = t / 1000; b = t % 1000;
|
|
a = t / 1000; b = t % 1000;
|
|
- chsnprintf(buf, 22, "T = %d.%03u oC ", a, b);
|
|
|
|
- ST7735_WriteString(0, 40, buf, LiberM_7x10, Yellow, Black);
|
|
|
|
|
|
+ chsnprintf(buf, 22, "T = %d.%03u °C ", a, b);
|
|
|
|
+ ST7735_WriteString(0, LCD_LINE_1, buf, LiberM_7x10, Yellow, Black);
|
|
}
|
|
}
|
|
|
|
+ chThdSleepMilliseconds(1000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -130,9 +127,9 @@ int main(void) {
|
|
static void lcd_MainScreen(void) {
|
|
static void lcd_MainScreen(void) {
|
|
ST7735_FillScreen(Black);
|
|
ST7735_FillScreen(Black);
|
|
|
|
|
|
- ST7735_WriteString(47, 38, "Heater", Font_11x18, Yellow, Black);
|
|
|
|
- ST7735_WriteString(52, 58, "Power", Font_11x18, Yellow, Black);
|
|
|
|
- ST7735_WriteString(25, 78, "Stabilizer", Font_11x18, Yellow, Black);
|
|
|
|
|
|
+ ST7735_WriteString(47, LCD_LINE_2, "Heater", Font_11x18, Yellow, Black);
|
|
|
|
+ ST7735_WriteString(52, LCD_LINE_4, "Power", Font_11x18, Yellow, Black);
|
|
|
|
+ ST7735_WriteString(25, LCD_LINE_6, "Stabilizer", Font_11x18, Yellow, Black);
|
|
chThdSleepMilliseconds(1000);
|
|
chThdSleepMilliseconds(1000);
|
|
|
|
|
|
/* top info line */
|
|
/* top info line */
|