2 Commits

Author SHA1 Message Date
MiroChao
81b6a600cb Update main.ts 2020-01-02 11:20:53 +08:00
MiroChao
f2f5a34bd5 Update main.ts 2020-01-02 11:20:53 +08:00

16
main.ts
View File

@@ -260,9 +260,8 @@ namespace grove {
//% blockId=grove_tm1637_display_number block="%strip|show number|%dispData"
show(dispData: number)
{
let compare_01:number = Math.floor(dispData / 10);
let compare_001:number = Math.floor(dispData / 100);
let compare_0001:number = Math.floor(dispData / 1000);
let compare_01:number = dispData % 100;
let compare_001:number = dispData % 1000;
if(dispData < 10)
{
@@ -298,7 +297,7 @@ namespace grove {
}
this.bit(0x7f, 0);
}
else
else if(dispData < 10000)
{
this.bit(dispData % 10, 3);
if(compare_01 > 90){
@@ -311,12 +310,19 @@ namespace grove {
} else{
this.bit(Math.floor(dispData / 100) % 10, 1);
}
if(compare_0001 > 9000){
if(dispData > 9000){
this.bit(9, 0);
} else{
this.bit(Math.floor(dispData / 1000) % 10, 0);
}
}
else
{
this.bit(9, 3);
this.bit(9, 2);
this.bit(9, 1);
this.bit(9, 0);
}
}
/**