File tree 2 files changed +23
-2
lines changed
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { logger } from "../logger/Logger" ;
2
+ import { DeviceBinding } from "../boards/Controller" ;
3
+ import { setTimeout , clearTimeout } from "timers" ;
4
+ import { utils } from "../boards/Constants" ;
5
+
6
+ import * as fs from 'fs' ;
7
+ import { GenericDeviceBase } from "./genericDevices" ;
8
+ import { webApp } from "../web/Server" ;
9
+
10
+ export class Themistor10k extends GenericDeviceBase {
11
+ protected logError ( err , msg ?: string ) { logger . error ( `${ this . device . name } ${ typeof msg !== 'undefined' ? msg + ' ' : '' } ${ typeof err !== 'undefined' ? err . message : '' } ` ) ; }
12
+ public async setValues ( vals ) : Promise < any > {
13
+ try {
14
+ return Promise . resolve ( this . values ) ;
15
+ }
16
+ catch ( err ) { this . logError ( err ) ; Promise . reject ( err ) ; }
17
+ finally { }
18
+ }
19
+ }
20
+
21
+
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export class SpiAdcChannel {
115
115
return new Promise < void > ( ( resolve , reject ) => {
116
116
this . busNumber = opts . busNumber ;
117
117
try {
118
- logger . info ( `Attempting to open SPI Bus #${ opts . busNumber } Channel #${ this . channel } ` ) ;
118
+ // logger.info(`Attempting to open SPI Bus #${opts.busNumber} Channel #${this.channel}`);
119
119
this . _spiDevice = spiBus . open ( opts . busNumber || 0 , this . channel , err => {
120
120
if ( err ) {
121
121
logger . error ( `SPI${ opts . busNumber } Channel ${ this . channel } library error: ${ err . message } ` ) ;
@@ -124,10 +124,10 @@ export class SpiAdcChannel {
124
124
else {
125
125
this . isOpen = true ;
126
126
setTimeout ( async ( ) => { await this . readAsync ( ) ; } , 500 ) ;
127
+ logger . info ( `Opened SPI Bus #${ opts . busNumber } Channel #${ this . channel } ` ) ;
127
128
resolve ( ) ;
128
129
}
129
130
} ) ;
130
- logger . info ( `Opened SPI Bus #${ opts . busNumber } Channel #${ this . channel } ` ) ;
131
131
} catch ( err ) { logger . error ( `Error opening SPI${ opts . busNumber } Channel ${ this . channel } : ${ err . message } ` ) ; }
132
132
} ) ;
133
133
}
You can’t perform that action at this time.
0 commit comments