Commit 7b79c157 authored by Werner Sembach's avatar Werner Sembach
Browse files

Cleanup

parent 056604a9
...@@ -128,7 +128,7 @@ extern "C" bool simulate_spring(struct spring springs[], int len) { ...@@ -128,7 +128,7 @@ extern "C" bool simulate_spring(struct spring springs[], int len) {
uint16_t adc_value = adc_get(11); uint16_t adc_value = adc_get(11);
for(int i = 0; i < len; i++){ for(int i = 0; i < len; i++){
// ezs_printf("%d\n", adc_value); //ezs_printf("%d\n", adc_value);
if (adc_value < springs[i].threshold){ if (adc_value < springs[i].threshold){
if (springs[i].power < 0){ if (springs[i].power < 0){
if (springs[i].direction == 'l'){ if (springs[i].direction == 'l'){
...@@ -148,31 +148,12 @@ extern "C" bool simulate_spring(struct spring springs[], int len) { ...@@ -148,31 +148,12 @@ extern "C" bool simulate_spring(struct spring springs[], int len) {
dc_set(0,0); dc_set(0,0);
} }
} }
return springs[i].solved; return springs[i].solved;
} }
} }
// in case no threshold is "reached" (e.g. the struct params are faulty) // in case no threshold is "reached" (e.g. the struct params are faulty)
// the box shouldn't be unopenable then // the box shouldn't be unopenable then
return true; return true;
/*old stuff without params:
if (adc_value < 256) {
//potty protection deadzone
dc_set(0, 0);
}
else if(adc_value > (4096 - 256)) {
//spring is "broken"
dc_set(0, 0);
return true;
}
else {
//main simulation
dc_set(DC_RIGHT, adc_value / 4096.0 * 255);
}
return false;
*/
} }
// turns the motor real fast if above certain position // turns the motor real fast if above certain position
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment