fixed stupid casting issues for overfloew detection

This commit is contained in:
kiu 2011-08-03 22:54:42 +02:00
parent 3f3d1a9d23
commit 2a18d27530
2 changed files with 4 additions and 4 deletions

View File

@ -94,7 +94,7 @@ void tick_flame(void) { // every 10ms
}
if (flameMode == FLAME_UP) {
if (flameI2Cpwm + flameSpeedUp > flameI2Cpwm ) {
if (0xFF - flameI2Cpwm >= flameSpeedUp ) {
flameI2Cpwm += flameSpeedUp;
} else {
flameI2Cpwm = 0xFF;
@ -113,7 +113,7 @@ void tick_flame(void) { // every 10ms
}
if (flameMode == FLAME_DOWN) {
if (flameI2Cpwm - flameSpeedDown < flameI2Cpwm ) {
if (flameSpeedDown <= flameI2Cpwm) {
flameI2Cpwm -= flameSpeedDown;
} else {
flameI2Cpwm = 0x00;

View File

@ -84,7 +84,7 @@ void tick_flame(void) { // every 10ms
}
if (flameMode == FLAME_UP) {
if (flameI2Cpwm + flameSpeedUp > flameI2Cpwm ) {
if (0xFF - flameI2Cpwm >= flameSpeedUp) {
flameI2Cpwm += flameSpeedUp;
} else {
flameI2Cpwm = 0xFF;
@ -103,7 +103,7 @@ void tick_flame(void) { // every 10ms
}
if (flameMode == FLAME_DOWN) {
if (flameI2Cpwm - flameSpeedDown < flameI2Cpwm ) {
if (flameSpeedDown <= flameI2Cpwm) {
flameI2Cpwm -= flameSpeedDown;
} else {
flameI2Cpwm = 0x00;