Browse Source

fixed undefined behaviour when left shifting a negative number

Tom Mittendorf 1 year ago
parent
commit
24b638b5d4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Firmware/Dcodes.cpp

+ 1 - 1
Firmware/Dcodes.cpp

@@ -584,7 +584,7 @@ void dcode_9()
 			if (code_seen('V')) // value to be written as simulated
 			{
 				adc_sim_mask |= (1 << index);
-				adc_values[index] = (((int)code_value()) << 4);
+				adc_values[index] = ((uint16_t)code_value_short() << 4);
 				printf_P(PSTR("ADC%d=%4d\n"), index, adc_values[index] >> 4);
 			}
 		}