Skip to content

Commit

Permalink
== Bug fix, spinner not appearing for when reloading features
Browse files Browse the repository at this point in the history
   after a reset request

feature_base_model.cpp:
- class FeatureBaseModel:
  - reloadFeatures():
    - bug fix: VcpEndInitialLoadRequest was being output after each VcpGetRequest
	  causing spinner to not show for long running reload
  - modelVcpValueSet(), reloadFeatures()
    - modify debuggng code

== Changes to debug code only

feature_widget.cpp:
- FeatuerWidget::onInternalValueChanged():
  - debugging code

feature_scrollarea_contents.cpp:
- class FeatureScrollAreaContents:
  - methods startInitialLoad(), endInitialLoad()
    - modify debugging code

feature_scrollarea_view.cpp:
- class FeaturesScrollareaView:
  - onUIValueChanged():
    - modify debugging code

value_stacked_widget.cpp
- class ValueStackedWidget:
  - onContainedWidgetChanged()
    - modify debugging code
  • Loading branch information
rockowitz committed Sep 17, 2018
1 parent c23c4e5 commit 48eab4e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
4 changes: 3 additions & 1 deletion src/feature_scrollarea/feature_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ void FeatureWidget::dbgrpt() const {


void FeatureWidget::onInternalValueChanged(uint8_t featureCode, uint8_t sh, uint8_t sl) {
PRINTFCMF(debugSignals, "feature_code = 0x%02x, sh=0x%02x, sl=0x%02x", featureCode, sh, sl);
bool debug = debugSignals;
debug = false;
PRINTFCMF(debug, "feature_code = 0x%02x, sh=0x%02x, sl=0x%02x", featureCode, sh, sl);
assert(featureCode == _feature_code);

bool writeOnlyFeature = _feature_flags & DDCA_WO;
Expand Down
8 changes: 6 additions & 2 deletions src/feature_scrollarea/features_scrollarea_contents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,19 @@ void FeaturesScrollAreaContents::featureUpdated(char feature_code)

void FeaturesScrollAreaContents::startInitialLoad(void)
{
printf("(%s::%s)\n", _cls, __func__); fflush(stdout);
bool debugFunc = debugWidget;
debugFunc = false;
PRINTFTCMF(debugFunc, "Executing");
assert(_containingScrollArea != nullptr);
// _containingScrollArea->hide();

}

void FeaturesScrollAreaContents::endInitialLoad()
{
PRINTFCMF(debugWidget, "Executing");
bool debugFunc = debugWidget;
debugFunc = false;
PRINTFTCMF(debugFunc, "Executing");
assert(_containingScrollArea);

emit showCentralWidgetByWidget(_containingScrollArea);
Expand Down
6 changes: 4 additions & 2 deletions src/feature_scrollarea/features_scrollarea_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ void FeaturesScrollAreaView::onUIValueChanged(
uint8_t sh,
uint8_t sl)
{
PRINTFTCMF(debugSignals,
bool debug = debugSignals;
debug = false;
PRINTFTCMF(debug,
"feature_code = 0x%02x, writeOnly=%s, sh=0x%02x, sl=0x%02x",
featureCode, sbool(writeOnly), sh, sl);

Expand Down Expand Up @@ -189,7 +191,7 @@ void FeaturesScrollAreaView::onUIValueChanged(
}
}

PRINTFTCMF(debugSignals, "Done");
PRINTFTCMF(debug, "Done");
}


Expand Down
6 changes: 4 additions & 2 deletions src/feature_value_widgets/value_stacked_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,13 @@ uint16_t ValueStackedWidget::getCurrentValue() {

void ValueStackedWidget::onContainedWidgetChanged(uint8_t feature_code, uint8_t sh, uint8_t sl)
{
PRINTFCMF(debugValueWidgetSignals,
bool debug = debugValueWidgetSignals;
debug = false;
PRINTFCMF(debug,
"feature_code=0x%02x, sh=0x%02x, sl=0x%02x", feature_code, sh, sl);
assert(feature_code == _featureCode);

PRINTFCMF(debugValueWidgetSignals,
PRINTFCMF(debug,
"Calling emit stackedFeatureValueChanged(), feature_code=0x%02x, sh=0x%02x, sl=0x%02x",
feature_code, sh, sl);
emit stackedFeatureValueChanged(feature_code, sh, sl);
Expand Down
27 changes: 9 additions & 18 deletions src/nongui/feature_base_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ void FeatureBaseModel::modelVcpValueSet(
DDCA_Feature_Metadata metadata,
DDCA_Non_Table_Vcp_Value * feature_value)
{
if (debugModel)
bool debugFunc = debugModel;
if (debugFunc)
PRINTFTCM("feature_code=0x%02x, mh=0x%02x, ml=0x%02x, sh=0x%02x, sl=0x%02x",
feature_code, feature_value->mh, feature_value->ml, feature_value->sh, feature_value->sl);

Expand All @@ -137,8 +138,7 @@ void FeatureBaseModel::modelVcpValueSet(
// MAY DO A FULL LOAD MULTIPLE TIMES, E.G if switch table type
// assert(ndx < 0);
if (ndx < 0) {
if (debugModel)
PRINTFTCM("Creating new FeatureValue");
PRINTFTCMF(debugFunc, "Creating new FeatureValue");

DDCA_Cap_Vcp * cap_vcp = NULL;
if (_parsed_caps)
Expand Down Expand Up @@ -166,7 +166,7 @@ void FeatureBaseModel::modelVcpValueSet(
// fv->_value.sl = feature_value->sl;
fv->setCurrentValue(feature_value->sh, feature_value->sl);

PRINTFTCM("Emitting signalFeatureUpdated3(), feature code: 0x%02x, sl: 0x%02x",
PRINTFTCMF(debugFunc, "Emitting signalFeatureUpdated3(), feature code: 0x%02x, sl: 0x%02x",
fv->featureCode(), feature_value->sl);
emit signalFeatureUpdated3(__func__, fv->featureCode(), feature_value->sh, feature_value->sl);
}
Expand Down Expand Up @@ -245,7 +245,7 @@ FeatureBaseModel::setFeatureList(
bool reportUnsupported)
{
bool debugFunc = debugFeatureLists;
// debugFunc = true;
debugFunc = true;
PRINTFTCMF(debugFunc, "Starting. Features: %s",
ddca_feature_list_string(&featureList, NULL, (char*) " "));
_featuresToShow = featureList;
Expand All @@ -258,24 +258,15 @@ FeatureBaseModel::setFeatureList(
ddca_feature_list_string(&unchecked_features, NULL, (char*) " "));
}

#ifdef OLD
cout << "Unchecked features: " << endl;
for (int ndx = 0; ndx <= 255; ndx++) {
if ( ddca_feature_list_contains(&unchecked_features, (uint8_t) ndx))
printf("%02x ", ndx);
}
cout << endl;
#endif

_monitor->_requestQueue->put(new VcpStartInitialLoadRequest);

for (int ndx = 0; ndx <= 255; ndx++) {
uint8_t vcp_code = (uint8_t) ndx;
if ( ddca_feature_list_contains(&unchecked_features, vcp_code)) {
_monitor->_requestQueue->put( new VcpGetRequest(vcp_code, reportUnsupported));
}
}
_monitor->_requestQueue->put(new VcpEndInitialLoadRequest);

PRINTFTCMF(debugFunc, "Done");
}

Expand All @@ -287,7 +278,7 @@ void FeatureBaseModel::setFeatureChecked(uint8_t featureCode) {

void FeatureBaseModel::reloadFeatures() {
bool debugFunc = debugFeatureLists;
debugFunc = true;
debugFunc = false;
PRINTFTCMF(debugFunc, "Starting.");

_monitor->_requestQueue->put(new VcpStartInitialLoadRequest);
Expand All @@ -299,8 +290,8 @@ void FeatureBaseModel::reloadFeatures() {
if (flags & DDCA_RW) {
_monitor->_requestQueue->put( new VcpGetRequest(featureCode));
}
_monitor->_requestQueue->put(new VcpEndInitialLoadRequest);
}
_monitor->_requestQueue->put(new VcpEndInitialLoadRequest);

PRINTFTCMF(debugFunc, "Done");
}
Expand All @@ -327,7 +318,7 @@ void FeatureBaseModel::dbgrpt() {


void FeatureBaseModel::modelStartInitialLoad(void) {
// PRINTFTCM("Emitting signalStartInitialLoad");
PRINTFTCM("Emitting signalStartInitialLoad");
emit signalStartInitialLoad();
}

Expand Down

0 comments on commit 48eab4e

Please sign in to comment.