remove old code comments

This commit is contained in:
interfisch 2020-04-12 15:03:37 +02:00
parent 097506d8c5
commit 01f1a36196
1 changed files with 2 additions and 152 deletions

View File

@ -19,7 +19,6 @@ uint32_t Wheel(byte WheelPos);
boolean srRead(uint8_t pbit);
void srWrite(uint8_t pbit, boolean state);
void callback(char* topic, byte* payload, unsigned int length);
void sendData();
void srShiftOut();
void setMuteInt(uint8_t i);
void setSelectionInt(uint8_t i);
@ -302,66 +301,7 @@ void loop() {
}
//Motor Movement Routine #################
/*
if (error==0){ //no errors
if (!poti_reachedposition && abs(poti_read-poti_set)>DEADZONE_POTI){ //difference too high
if (poti_read-poti_set < 0){
MOTOR_LEFT();
}else{
MOTOR_RIGHT();
}
}else if(!poti_reachedposition){ //position reached but flag not set
MOTOR_STOP();
Serial.print("reached:");
Serial.print(" set=");
Serial.print(poti_set);
Serial.print(" is=");
Serial.print(poti_read);
Serial.print(" vel=");
Serial.println();
poti_reachedposition=true; //position reached
}
if ( loopmillis > last_motorcheck+INTERVAL_MOTORCHECK){
last_motorcheck=loopmillis;
motor_vel=(poti_read-poti_read_last)*1000 /INTERVAL_MOTORCHECK ; //calculate current motor velocity
poti_read_last=poti_read;
//motor fail check
if (MOTOR_TURNING() && abs(motor_vel)<MINIMUM_MOTORVEL){ //motor is turning too slow
if (last_motorTooSlow==0){ //first time slow motor recognized
last_motorTooSlow=loopmillis;
}else if (loopmillis-last_motorTooSlow > MOTOR_FAILTIME){
error=MOTORDIDNOTTURN;
Serial.println("MOTORDIDNOTTURN");
}
}else if (last_motorTooSlow>0){ //was recognized too slow but is now turning fast again
last_motorTooSlow=0; //reset
}
}
}else{ //an error occured. error!=0
MOTOR_STOP();
}
*/
//Test
/*if (poti_set == 512){
MOTOR_STOP();
}else if (poti_set < 512){
motorspeed=(512-poti_set)/2;
MOTOR_LEFT_PWM();
}else if (poti_set > 512){
motorspeed=(poti_set-512)/2;
MOTOR_RIGHT_PWM();
}*/
//Motor Movement Routine #################
if (!motorerror) //motor not stuck etc
{
@ -448,20 +388,6 @@ void loop() {
}
void sendData() {
char msgBuffer[20];
float h = 50;
float testvalue = 42;
/*
Serial.print("testvalue: ");
Serial.print(testvalue);
Serial.println();
if (mqttClient.connect(CLIENT_ID)) {
mqttClient.publish("audiomixer/messwert/parameter", dtostrf(testvalue, 6, 2, msgBuffer));
//mqttClient.publish(DEVICENAME+"/br/nb/deur", (statusBD == HIGH) ? "OPEN" : "CLOSED");
}*/
}
void callback(char* topic, byte* payload, unsigned int length) {
payload[length] = '\0'; //add end of string character
@ -474,11 +400,6 @@ void callback(char* topic, byte* payload, unsigned int length) {
Serial.println();
//if (strncmp((const char*)payload, "ON", 2) == 0) {
//}
//if (strncmp((const char*)topic, "audiomixer/volume/set",sizeof(topic)) == 0) {
if (String(topic).equals("audiomixer/volume/set")){
@ -501,18 +422,7 @@ void callback(char* topic, byte* payload, unsigned int length) {
}else if (ipayload>=0 && ipayload<((uint16_t)1<<NUMMUTECHANNELS)){ //in range
setMuteInt(ipayload); //set bits directly
}
//publish all states
/*
for (uint8_t i=0;i<NUMMUTECHANNELS;i++) {
String pub_topic = "audiomixer/mute_"+String(i);
boolean _mutestate=getMute(i);
if (_mutestate) {
mqttClient.publish((char*) pub_topic.c_str(), "true");
}else{
mqttClient.publish((char*) pub_topic.c_str(), "false");
}
}*/
publishAllStates(NUMMUTECHANNELS,"mute_", &getMute);
}else if (String(topic).equals("audiomixer/select/set")) { //withouth range
@ -526,73 +436,13 @@ void callback(char* topic, byte* payload, unsigned int length) {
setSelectionInt(ipayload); //set bits directly
}
//publish all states
/*for (uint8_t i=0;i<NUMSELECTCHANNELS;i++) {
String pub_topic = "audiomixer/select_"+String(i);
boolean _selectstate=getSelection(i);
if (_selectstate) {
mqttClient.publish((char*) pub_topic.c_str(), "true");
}else{
mqttClient.publish((char*) pub_topic.c_str(), "false");
}
}*/
publishAllStates(NUMSELECTCHANNELS,"select_", &getSelection);
}else if (String(topic).startsWith("audiomixer/mute_")) { //with range
//Serial.print("Mute range string="); Serial.println(spayload);
/*uint8_t _index=255;
for (uint8_t i=0; i<NUMMUTECHANNELS && _index==255; i++) {
if (String(topic).equals("audiomixer/mute_"+String(i)+"/set")) {
_index=i;
}
}
Serial.print("Found index:"); Serial.println(_index);
if (_index==255) {
Serial.println("Index OOR");
}else{ //index ok
String pub_topic = "audiomixer/mute_"+String(_index);
if (spayload.equalsIgnoreCase("false")) {
setMuteChannel(_index,false);
mqttClient.publish((char*) pub_topic.c_str(), "false");
}else if (spayload.equalsIgnoreCase("true")) {
setMuteChannel(_index,true);
mqttClient.publish((char*) pub_topic.c_str(), "true");
}
}*/
changeRelaisByNumber(NUMMUTECHANNELS,"audiomixer/mute_", topic, spayload, &setMuteChannel);
}else if (String(topic).startsWith("audiomixer/select_")) {
//Serial.print("Select string="); Serial.println(spayload);
/*uint8_t _index=255;
for (uint8_t i=0; i<NUMSELECTCHANNELS && _index==255; i++) {
if (String(topic).equals("audiomixer/select_"+String(i)+"/set")) {
_index=i;
}
}
//Serial.print("Found index:"); Serial.println(_index);
if (_index==255) {
Serial.println("Index OOR");
}else{ //index ok
String pub_topic = "audiomixer/select_"+String(_index);
if (spayload.equalsIgnoreCase("false")) {
setSelectionChannel(_index,false);
mqttClient.publish((char*) pub_topic.c_str(), "false");
}else if (spayload.equalsIgnoreCase("true")) {
setSelectionChannel(_index,true);
mqttClient.publish((char*) pub_topic.c_str(), "true");
}
}*/
changeRelaisByNumber(NUMSELECTCHANNELS,"audiomixer/select_", topic, spayload, &setSelectionChannel);
}