log script debug in fragment
This commit is contained in:
parent
28c329dc01
commit
6621c2f610
|
@ -51,6 +51,8 @@ public class DetermineBasalAdapterAMAJS {
|
|||
private String storedMeal_data = null;
|
||||
private String storedAutosens_data = null;
|
||||
|
||||
private String scriptDebug = "";
|
||||
|
||||
/**
|
||||
* Main code
|
||||
*/
|
||||
|
@ -183,6 +185,10 @@ public class DetermineBasalAdapterAMAJS {
|
|||
return storedAutosens_data;
|
||||
}
|
||||
|
||||
String getScriptDebug() {
|
||||
return scriptDebug;
|
||||
}
|
||||
|
||||
private void loadScript() throws IOException {
|
||||
mV8rt.executeVoidScript(readFile("OpenAPSAMA/round-basal.js"), "OpenAPSAMA/round-basal.js", 0);
|
||||
mV8rt.executeVoidScript("var round_basal = module.exports;");
|
||||
|
@ -236,8 +242,10 @@ public class DetermineBasalAdapterAMAJS {
|
|||
s += arg + " ";
|
||||
i++;
|
||||
}
|
||||
if (!s.equals("") && Config.logAPSResult)
|
||||
if (!s.equals("") && Config.logAPSResult) {
|
||||
log.debug("Script debug: " + s);
|
||||
scriptDebug += s + "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
mV8rt.registerJavaMethod(callbackLog, "log");
|
||||
|
|
|
@ -44,6 +44,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
TextView mealDataView;
|
||||
TextView autosensDataView;
|
||||
TextView resultView;
|
||||
TextView scriptdebugView;
|
||||
TextView requestView;
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +61,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
profileView = (TextView) view.findViewById(R.id.openapsma_profile);
|
||||
mealDataView = (TextView) view.findViewById(R.id.openapsma_mealdata);
|
||||
autosensDataView = (TextView) view.findViewById(R.id.openapsma_autosensdata);
|
||||
scriptdebugView = (TextView) view.findViewById(R.id.openapsma_scriptdebugdata);
|
||||
resultView = (TextView) view.findViewById(R.id.openapsma_result);
|
||||
requestView = (TextView) view.findViewById(R.id.openapsma_request);
|
||||
|
||||
|
@ -124,6 +126,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
profileView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getProfileParam()));
|
||||
mealDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getMealDataParam()));
|
||||
autosensDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getAutosensDataParam()));
|
||||
scriptdebugView.setText(determineBasalAdapterAMAJS.getScriptDebug());
|
||||
}
|
||||
if (getPlugin().lastAPSRun != null) {
|
||||
lastRunView.setText(getPlugin().lastAPSRun.toLocaleString());
|
||||
|
@ -145,6 +148,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
|||
profileView.setText("");
|
||||
mealDataView.setText("");
|
||||
autosensDataView.setText("");
|
||||
scriptdebugView.setText("");
|
||||
requestView.setText("");
|
||||
lastRunView.setText("");
|
||||
}
|
||||
|
|
|
@ -156,6 +156,20 @@
|
|||
android:background="@color/linearBlockBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/openapsma_scriptdebugdata_label"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:layout_marginLeft="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/openapsma_scriptdebugdata"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -402,4 +402,5 @@
|
|||
<string name="long_avgdelta">Long avg. delta</string>
|
||||
<string name="array_of_elements">Array of %d elements.\nActual value:</string>
|
||||
<string name="openapsma_autosensdata_label">Autosens data</string>
|
||||
<string name="openapsma_scriptdebugdata_label">Script debug</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue