/** * Gets the color for the current time from the specific algorithm assigned * to the box. Returns false if no color was found because we've exceeded * the duration of the color cycle. */ bool tilt_light_box_getColorFromAlg(TiltBox *box, unsigned char *result) { switch (box->colorAlg) { case COLOR_ALG__PURPLE_CALM: return color_alg_purple_calm__getColor(&box->purpleCalmAlgState, box->boxState, result); case COLOR_ALG__DISCO: return color_alg_disco__getColor(&box->discoAlgState, box->boxState, result); default: // TODO [rkenney]: Throw an exception? return false; } }
/** * Gets the color for the current time from the specific algorithm assigned * to the box. Returns false if no color was found because we've exceeded * the duration of the color cycle. */ bool tilt_light_box_getColorFromAlg(TiltBox *box, unsigned char *result) { switch (box->colorAlg) { case COLOR_ALG__PURPLE_CALM: return color_alg_purple_calm__getColor(&box->purpleCalmAlgState, box->boxState, result); case COLOR_ALG__DISCO: return color_alg_disco__getColor(&box->discoAlgState, box->boxState, result); case COLOR_ALG__OFF: return color_alg_off__getColor(&box->offAlgState, box->boxState, result); case COLOR_ALG__A: return color_alg_a__getColor(&box->xAlgState, box->boxState, result); case COLOR_ALG__B: return color_alg_b__getColor(&box->xAlgState, box->boxState, result); case COLOR_ALG__C: return color_alg_c__getColor(&box->xAlgState, box->boxState, result); case COLOR_ALG__D: return color_alg_d__getColor(&box->xAlgState, box->boxState, result); default: return false; } }