fixed stupid casting issues for overfloew detection
This commit is contained in:
parent
3f3d1a9d23
commit
2a18d27530
|
@ -94,7 +94,7 @@ void tick_flame(void) { // every 10ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flameMode == FLAME_UP) {
|
if (flameMode == FLAME_UP) {
|
||||||
if (flameI2Cpwm + flameSpeedUp > flameI2Cpwm ) {
|
if (0xFF - flameI2Cpwm >= flameSpeedUp ) {
|
||||||
flameI2Cpwm += flameSpeedUp;
|
flameI2Cpwm += flameSpeedUp;
|
||||||
} else {
|
} else {
|
||||||
flameI2Cpwm = 0xFF;
|
flameI2Cpwm = 0xFF;
|
||||||
|
@ -113,7 +113,7 @@ void tick_flame(void) { // every 10ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flameMode == FLAME_DOWN) {
|
if (flameMode == FLAME_DOWN) {
|
||||||
if (flameI2Cpwm - flameSpeedDown < flameI2Cpwm ) {
|
if (flameSpeedDown <= flameI2Cpwm) {
|
||||||
flameI2Cpwm -= flameSpeedDown;
|
flameI2Cpwm -= flameSpeedDown;
|
||||||
} else {
|
} else {
|
||||||
flameI2Cpwm = 0x00;
|
flameI2Cpwm = 0x00;
|
||||||
|
|
|
@ -84,7 +84,7 @@ void tick_flame(void) { // every 10ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flameMode == FLAME_UP) {
|
if (flameMode == FLAME_UP) {
|
||||||
if (flameI2Cpwm + flameSpeedUp > flameI2Cpwm ) {
|
if (0xFF - flameI2Cpwm >= flameSpeedUp) {
|
||||||
flameI2Cpwm += flameSpeedUp;
|
flameI2Cpwm += flameSpeedUp;
|
||||||
} else {
|
} else {
|
||||||
flameI2Cpwm = 0xFF;
|
flameI2Cpwm = 0xFF;
|
||||||
|
@ -103,7 +103,7 @@ void tick_flame(void) { // every 10ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flameMode == FLAME_DOWN) {
|
if (flameMode == FLAME_DOWN) {
|
||||||
if (flameI2Cpwm - flameSpeedDown < flameI2Cpwm ) {
|
if (flameSpeedDown <= flameI2Cpwm) {
|
||||||
flameI2Cpwm -= flameSpeedDown;
|
flameI2Cpwm -= flameSpeedDown;
|
||||||
} else {
|
} else {
|
||||||
flameI2Cpwm = 0x00;
|
flameI2Cpwm = 0x00;
|
||||||
|
|
Loading…
Reference in New Issue