@@ -92,7 +92,6 @@ void HidFFB::hidOut(uint8_t report_id, hid_report_type_t report_type, uint8_t co
9292 const uint8_t * report = buffer;
9393 uint8_t event_idx = report_id - FFB_ID_OFFSET;
9494
95-
9695 // -------- Out Reports --------
9796 switch (event_idx)
9897 {
@@ -196,10 +195,16 @@ uint16_t HidFFB::hidGet(uint8_t report_id, hid_report_type_t report_type,uint8_t
196195}
197196
198197void HidFFB::start_FFB (){
198+ #ifdef DEBUGLOG
199+ CommandHandler::logSerialDebug (" FFB on" );
200+ #endif
199201 this ->set_FFB (true );
200202}
201203
202204void HidFFB::stop_FFB (){
205+ #ifdef DEBUGLOG
206+ CommandHandler::logSerialDebug (" FFB off" );
207+ #endif
203208 this ->set_FFB (false );
204209}
205210
@@ -221,7 +226,7 @@ void HidFFB::set_filters(FFB_Effect *effect){
221226}
222227
223228void HidFFB::ffb_control (uint8_t cmd){
224- // printf("Got Control signal: %d\n",cmd);
229+
225230 if (cmd & 0x01 ){ // enable
226231 start_FFB ();
227232 }if (cmd & 0x02 ){ // disable
@@ -260,12 +265,17 @@ void HidFFB::new_effect(FFB_CreateNewEffect_Feature_Data_t* effect){
260265 uint8_t index = find_free_effect (effect->effectType ); // next effect
261266 if (index == 0 ){
262267 blockLoad_report.loadStatus = 2 ;
263- // CommandHandler::logSerial("Can't allocate a new effect");
268+ #ifdef DEBUGLOG
269+ CommandHandler::logSerialDebug (" Can't allocate a new effect" );
270+ #endif
264271 return ;
265272 }
266273 FFB_Effect new_effect;
267274 new_effect.type = effect->effectType ;
268275 this ->effects_calc ->logEffectType (effect->effectType );
276+ #ifdef DEBUGLOG
277+ CommandHandler::logSerialDebug (" New effect type:" + std::to_string (effect->effectType ) + " idx: " + std::to_string (index-1 ));
278+ #endif
269279
270280 set_filters (&new_effect);
271281
@@ -311,7 +321,7 @@ void HidFFB::set_effect(FFB_SetEffect_t* effect){
311321 if (!ffb_active)
312322 start_FFB ();
313323 sendStatusReport (effect->effectBlockIndex ); // TODO required?
314- // CommandHandler::logSerial ("Setting Effect: " + std::to_string(effect->effectType) + " at " + std::to_string(index) + "\n");
324+ // CommandHandler::logSerialDebug ("Setting Effect: " + std::to_string(effect->effectType) + " at " + std::to_string(index) + "\n");
315325}
316326
317327void HidFFB::set_condition (FFB_SetCondition_Data_t *cond){
@@ -346,21 +356,27 @@ void HidFFB::set_effect_operation(FFB_EffOp_Data_t* report){
346356 uint8_t id = report->effectBlockIndex -1 ;
347357 if (report->state == 3 ){
348358 effects[id].state = 0 ; // Stop
349- // CommandHandler::logSerial("Stop" + std::to_string(id));
359+ #ifdef DEBUGLOG
360+ CommandHandler::logSerialDebug (" Stop effect: " + std::to_string (id));
361+ #endif
362+
350363 }else {
351364
352365 // 1 = start, 2 = start solo
353366 if (report->state == 2 ){
354- // CommandHandler::logSerial("Start solo" + std::to_string(id));
367+ #ifdef DEBUGLOG
368+ CommandHandler::logSerialDebug (" Start solo: " + std::to_string (id));
369+ #endif
355370 for (FFB_Effect& effect : effects){
356371 effect.state = 0 ; // Stop all other effects
357372 }
358373 }
359374 if (effects[id].state != 1 ){
360375 set_filters (&effects[id]);
361376 }
362-
363- // CommandHandler::logSerial("Start" + std::to_string(id));
377+ #ifdef DEBUGLOG
378+ CommandHandler::logSerialDebug (" Start effect: " + std::to_string (id));
379+ #endif
364380 effects[id].startTime = HAL_GetTick () + effects[id].startDelay ; // + effects[id].startDelay;
365381 effects[id].state = 1 ; // Start
366382
0 commit comments