Auto Format, can't figure out what it does

I'm using rc7 but I've never had any success with any version of auto format. However I seldom use it.

Can someone tell me or point to information on what I should expect from auto format?

I tried the below code expecting the autoformat to even out the indents but there was no change, I even selected all the code and Ctrl-T. = no change.

Am I missing something?


def illuminanceHandler(evt) {
LOGDEBUG("Running illuminance handler")

     if(state.luxSendOK == true){
  def ave = evt.value
   def aveDev = evt.device

LOGDEBUG( "Received from: $aveDev - $ave")
    def sum = 0
    def count = 0
    state.mean = 0
    state.mean1 = 0
    state.mean2 = 0
LOGDEBUG("sum = $sum")
    for (sensor in settings.illumSensors) {
    count += 1
LOGDEBUG( "Sensor data count = $count" )
    sum += sensor.currentIlluminance }
LOGDEBUG( "Total Combined value =  $sum")

    state.mean1 = sum/count
   state.mean2 = state.mean1.toFloat()
    state.mean = state.mean2.round(state.DecimalPlaces)

LOGDEBUG("Average Illuminance = $state.mean")


        def timeCheck1 = (60 * sendLuxInterval)
         if(timeCheck1 == 0){ timeCheck1 = 5}
LOGDEBUG("Sending $state.mean to $vDevice then waiting $timeCheck1 seconds before I can send again")
     settings.vDevice.setLux("${state.mean}")
     settings.vDevice.lastDeviceLux("${aveDev}")

        state.luxSendOK = false
//         log.warn "timecheck1 = $timeCheck1"
       runIn(timeCheck1, resetLuxNow)  // , [overwrite: false])
     }
    else {
LOGDEBUG("Waiting for timer to expire")
    }
}

Hi @JohnRob. What is this code? It is not Arduino or C++.

The Arduino IDE's auto format feature is for those programming languages so I don't think it really makes sense to talk about what it would do with some other language.

Please post some valid Arduino code and I'll be happy to help you out and investigate the issue.

;

My bad, the code I grabbed was groovy. I'll go find a C++ example.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.