|
@@ -30,8 +30,8 @@
|
|
|
* Provate variables.
|
|
|
*/
|
|
|
onewired_t owdc[ONWIRE_CHANNELS_NUM] = {
|
|
|
- {0, 0, onewire_OK, &ow_cfg1},
|
|
|
- {0, 0, onewire_OK, &ow_cfg2}
|
|
|
+ {0, 0, onewire_No_Dev, &ow_cfg1},
|
|
|
+ {0, 0, onewire_No_Dev, &ow_cfg2}
|
|
|
};
|
|
|
|
|
|
/*
|
|
@@ -99,32 +99,30 @@ int main(void) {
|
|
|
*/
|
|
|
ST7735_Init();
|
|
|
lcd_MainScreen();
|
|
|
- chThdSleepMilliseconds(2000);
|
|
|
+ chThdSleepMilliseconds(1000);
|
|
|
lcd_ClearMain();
|
|
|
|
|
|
/*
|
|
|
* Normal main() thread activity.
|
|
|
*/
|
|
|
int32_t t;
|
|
|
- int a, b, n;
|
|
|
+ int a, b;
|
|
|
|
|
|
ST7735_WriteString(0, LCD_LINE_1, "OneWire1 search...", LiberM_7x10, Blue, Black);
|
|
|
onewireMeasure(&owdc[ow1]);
|
|
|
- n = onewireGetDevicesNum(&owdc[ow1]);
|
|
|
- chsnprintf(buf, 22, "Found %d device[s]", n);
|
|
|
+ chsnprintf(buf, 22, "Found1 %d device[s]", owdc[ow1].dev_on_bus);
|
|
|
ST7735_WriteString(0, LCD_LINE_1, buf, LiberM_7x10, Cyan, Black);
|
|
|
|
|
|
ST7735_WriteString(0, LCD_LINE_2, "OneWire2 search...", LiberM_7x10, Blue, Black);
|
|
|
onewireMeasure(&owdc[ow2]);
|
|
|
- n = onewireGetDevicesNum(&owdc[ow2]);
|
|
|
- chsnprintf(buf, 22, "Found %d device[s]", n);
|
|
|
- ST7735_WriteString(0, LCD_LINE_1, buf, LiberM_7x10, Cyan, Black);
|
|
|
+ chsnprintf(buf, 22, "Found2 %d device[s]", owdc[ow2].dev_on_bus);
|
|
|
+ ST7735_WriteString(0, LCD_LINE_2, buf, LiberM_7x10, Cyan, Black);
|
|
|
|
|
|
chThdSleepMilliseconds(1000);
|
|
|
while (true) {
|
|
|
onewireMeasure(&owdc[ow1]);
|
|
|
if (owdc[ow1].err_code == onewire_OK) {
|
|
|
- t = onewireGetTemperature(&owdc[ow1]);
|
|
|
+ t = owdc[ow1].temperature;
|
|
|
t += 50;
|
|
|
t /= 100;
|
|
|
a = t / 10; b = t % 10;
|
|
@@ -135,9 +133,9 @@ int main(void) {
|
|
|
ST7735_WriteString(0, LCD_LINE_1, buf, LiberM_7x10, Red, Black);
|
|
|
}
|
|
|
|
|
|
- onewireMeasure(&owdc[ow1]);
|
|
|
+ onewireMeasure(&owdc[ow2]);
|
|
|
if (owdc[ow2].err_code == onewire_OK) {
|
|
|
- t = onewireGetTemperature(&owdc[ow2]);
|
|
|
+ t = owdc[ow2].temperature;
|
|
|
t += 50;
|
|
|
t /= 100;
|
|
|
a = t / 10; b = t % 10;
|