change switch to if/then/else for solution selection, so it compiles under DEBUG
authorJim Morris <morris@wolfman.com>
Wed, 13 Feb 2013 21:47:31 +0000 (13:47 -0800)
committerJim Morris <morris@wolfman.com>
Wed, 13 Feb 2013 21:47:31 +0000 (13:47 -0800)
src/modules/robot/Robot.cpp

index c9d185e..365e81a 100644 (file)
@@ -50,13 +50,22 @@ void Robot::on_module_loaded() {
 void Robot::on_config_reload(void* argument){
     if (this->arm_solution) delete this->arm_solution;
     int solution_checksum = get_checksum(this->kernel->config->value(arm_solution_checksum)->by_default("cartesian")->as_string());
-    switch(solution_checksum) {
-    case rostock_checksum:
-        this->arm_solution = new RostockSolution(this->kernel->config); break;
-    case cartesian_checksum:
-    default:
-        this->arm_solution = new CartesianSolution(this->kernel->config); break;
-    }
+
+       // Note checksums are not const expressions when in debug mode, so don't use switch
+       if(solution_checksum == rostock_checksum) {
+               this->arm_solution = new RostockSolution(this->kernel->config);
+
+       }else if(solution_checksum ==  delta_checksum) {
+               // place holder for now
+               this->arm_solution = new RostockSolution(this->kernel->config);
+
+       }else if(solution_checksum == cartesian_checksum) {
+               this->arm_solution = new CartesianSolution(this->kernel->config);
+
+       }else{
+               this->arm_solution = new CartesianSolution(this->kernel->config);
+       }
+
 
     this->feed_rate           = this->kernel->config->value(default_feed_rate_checksum   )->by_default(100    )->as_number() / 60;
     this->seek_rate           = this->kernel->config->value(default_seek_rate_checksum   )->by_default(100    )->as_number() / 60;