cleanup debug prints
This commit is contained in:
		
							parent
							
								
									62f774964d
								
							
						
					
					
						commit
						ef43526d2c
					
				
					 1 changed files with 24 additions and 23 deletions
				
			
		| 
						 | 
				
			
			@ -579,9 +579,12 @@ void mqtt_connect()
 | 
			
		|||
      publish_ac_state();
 | 
			
		||||
#endif
 | 
			
		||||
      mqtt_connected_user_callback();
 | 
			
		||||
#ifdef ENABLE_ANALOG_MODULE
 | 
			
		||||
      publish_dac_states();
 | 
			
		||||
      publish_dac_values();
 | 
			
		||||
      publish_adc_values();
 | 
			
		||||
      publish_adc_states();
 | 
			
		||||
#endif
 | 
			
		||||
      standalone = false;
 | 
			
		||||
      ESPMega_updateTimeFromNTP();
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1007,9 +1010,12 @@ void state_request_callback()
 | 
			
		|||
  publish_env_state();
 | 
			
		||||
#endif
 | 
			
		||||
  user_state_request_callback();
 | 
			
		||||
#ifdef ENABLE_ANALOG_MODULE
 | 
			
		||||
  publish_adc_states();
 | 
			
		||||
  publish_adc_values();
 | 
			
		||||
  publish_dac_states();
 | 
			
		||||
  publish_dac_values();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef ENABLE_IR_MODULE
 | 
			
		||||
| 
						 | 
				
			
			@ -1846,7 +1852,6 @@ void enable_adc(int id)
 | 
			
		|||
  adc_report_enable[id] = true;
 | 
			
		||||
  ESPMega_FRAM.write8(EEPROM_ADDRESS_ADC_REPORT_STATE + id, 1);
 | 
			
		||||
  publish_adc_state(id);
 | 
			
		||||
  Serial.println("ADC " + String(id) + " enabled.");
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Disables the ADC reporting for the specified ID.
 | 
			
		||||
| 
						 | 
				
			
			@ -1860,7 +1865,6 @@ void disable_adc(int id)
 | 
			
		|||
  adc_report_enable[id] = false;
 | 
			
		||||
  ESPMega_FRAM.write8(EEPROM_ADDRESS_ADC_REPORT_STATE + id, 0);
 | 
			
		||||
  publish_adc_state(id);
 | 
			
		||||
  Serial.println("ADC " + String(id) + " disabled.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void publish_adc_state(int id)
 | 
			
		||||
| 
						 | 
				
			
			@ -1889,7 +1893,6 @@ void adc_update(int id)
 | 
			
		|||
  {
 | 
			
		||||
    adc_values[id] = ESPMega_analogRead(id);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -1902,7 +1905,6 @@ void adc_update_force(int id)
 | 
			
		|||
  adc_values[id] = ESPMega_analogRead(id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Updates all ADC channels.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -1964,7 +1966,8 @@ void publish_dac_state(int id)
 | 
			
		|||
  mqtt.publish(DAC_STATE_TOPIC, dac_states[id] ? "on" : "off");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void publish_dac_value(int id) {
 | 
			
		||||
void publish_dac_value(int id)
 | 
			
		||||
{
 | 
			
		||||
  DAC_VALUE_TOPIC[base_topic_length + 4] = ((id - id % 10) / 10) + '0';
 | 
			
		||||
  DAC_VALUE_TOPIC[base_topic_length + 5] = (id % 10) + '0';
 | 
			
		||||
  char temp[6];
 | 
			
		||||
| 
						 | 
				
			
			@ -2001,11 +2004,9 @@ uint16_t get_adc_value(int id)
 | 
			
		|||
 */
 | 
			
		||||
void adc_set_state_callback(char *topic, uint8_t topic_length, char *payload, unsigned int payload_length)
 | 
			
		||||
{
 | 
			
		||||
  Serial.println(topic);
 | 
			
		||||
  int a = topic[5] - '0';
 | 
			
		||||
  int b = topic[6] - '0';
 | 
			
		||||
  int id = 10 * a + b;
 | 
			
		||||
  Serial.println("ID = "+String(id));
 | 
			
		||||
  if (!strcmp(payload, "on"))
 | 
			
		||||
  {
 | 
			
		||||
    enable_adc(id);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue