Does FEATURE_WIFI_POWERSAVE_CLOCK work in 0.7.0-rc.1/2/3 system firmware?

Should System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK) still function correctly in 0.7.0-rc.1/2/3 system firmware?

Thanks.

Anybody?

Ping @rickkas7

Thanks, @peekay123.

Hello @rickkas7, could you please take a look at my firmware question?

@shm45, you don’t need to post fresh when you bodged one post, you can edit your posts via the edit this post :pencil2: icon.

@shm45, looking at the firmware repo, the feature is only available on the P1.

2 Likes

Yes, the feature is P1 only, and the only reason you disable FEATURE_WIFI_POWERSAVE_CLOCK is that you need pin P1S6 as a GPIO pin. Since the Photon doesn’t expose PA8, there’s no need to disable it. Despite the name, it should have no effect on power usage in current system firmware.

It should still work on the P1 in 0.7.0. It compiles for me in 0.7.0rc3 but I don’t have a P1 that exposes P1S6 handy to verify that it actually is turning off the clock signal on P1S6.

2 Likes

Thanks @ScruffR, @peekay123, and @rickkas7.

I am using a P1 on a custom PCB that exposes P1S6, connected to an LED. I have tested the slightly modified tinker code below on the P1 custom PCB using system firmware 0.7.0-rc.1, 0.7.0-rc.2, and 0.7.0-rc.3, and in all three cases, when the P1 is attempting to connect to WiFi, the LED attached to the P1S6 pin turns on, indicating a logic high out of the P1S6 pin (or a PWM output on P1S6), which would mean the FEATURE_WIFI_POWERSAVE_CLOCK is not working with 0.7.0-rc.1/2/3 system firmware.

Would someone please run a similar test?

Thank you.

[CODE]

int tinkerDigitalRead(String pin);
int tinkerDigitalWrite(String command);
int tinkerAnalogRead(String pin);
int tinkerAnalogWrite(String command);

//PUT YOUR VARIABLES HERE

void Configure() {
// turn off PWM on P1S6 pin (Timer 1 Channel 1) during WiFi Acquisition mode
System.disableFeature(FEATURE_WIFI_POWERSAVE_CLOCK);
}

STARTUP(Configure());

void setup()
{
Spark.function(“digitalread”, tinkerDigitalRead);
Spark.function(“digitalwrite”, tinkerDigitalWrite);
Spark.function(“analogread”, tinkerAnalogRead);
Spark.function(“analogwrite”, tinkerAnalogWrite);

//PUT YOUR SETUP CODE HERE

}

void loop()
{
//PUT YOUR LOOP CODE HERE

}

int tinkerDigitalRead(String pin) {
int pinNumber = pin.charAt(1) - ‘0’;
if (pinNumber< 0 || pinNumber >7) return -1;
if(pin.startsWith(“D”)) {
pinMode(pinNumber, INPUT_PULLDOWN);
return digitalRead(pinNumber);}
else if (pin.startsWith(“A”)){
pinMode(pinNumber+10, INPUT_PULLDOWN);
return digitalRead(pinNumber+10);}
return -2;}

int tinkerDigitalWrite(String command){
bool value = 0;
int pinNumber = command.charAt(1) - ‘0’;
if (pinNumber< 0 || pinNumber >7) return -1;
if(command.substring(3,7) == “HIGH”) value = 1;
else if(command.substring(3,6) == “LOW”) value = 0;
else return -2;
if(command.startsWith(“D”)){
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, value);
return 1;}
else if(command.startsWith(“A”)){
pinMode(pinNumber+10, OUTPUT);
digitalWrite(pinNumber+10, value);
return 1;}
else return -3;}

int tinkerAnalogRead(String pin){
int pinNumber = pin.charAt(1) - ‘0’;
if (pinNumber< 0 || pinNumber >7) return -1;
if(pin.startsWith(“D”)){
pinMode(pinNumber, INPUT);
return analogRead(pinNumber);}
else if (pin.startsWith(“A”)){
pinMode(pinNumber+10, INPUT);
return analogRead(pinNumber+10);}
return -2;}

int tinkerAnalogWrite(String command){
int pinNumber = command.charAt(1) - ‘0’;
if (pinNumber< 0 || pinNumber >7) return -1;
String value = command.substring(3);
if(command.startsWith(“D”)){
pinMode(pinNumber, OUTPUT);
analogWrite(pinNumber, value.toInt());
return 1;}
else if(command.startsWith(“A”)){
pinMode(pinNumber+10, OUTPUT);
analogWrite(pinNumber+10, value.toInt());
return 1;}
else return -2;}

[/CODE]

1 Like

Could someone take a look and recreate the test?

@shm45, the code looks good to the eye and your test sounds valid.

Not sure there is any point in others repeating your test.

If you have not already done so, try shifting the call to Configure() to the top of setup() or a one off call within loop().

@shm45, did you ever resolve this?

Am having similar problems myself regarding the disablement of P1S6. Refer to post P1 - no WiFi/Cloud oscillates P1S6 pin